|
|
Rank: Member
Groups: Registered
Joined: 7/27/2007 Posts: 14
|
Hello,
I'm currently testing SlickUpload. It seems to fit very good to my companies project but there is one problem I'm facing.
The IUploadRequestFilter seems to cause trouble when ShouldHandleRequest returns false in some cases. First I used the UploadRequestFilter sample and set the return value to false at TestFilter.cs. When starting an upload nothing happens as expected(no upload summary is shown because there was no uplaod because ShouldHandleRequest returned false).
Then I took your UploadManager sample because it uses user controls and the progressBar is shown.
I added
<uploadParser requestFilter="TestFilter" />
to the slickUplaod-section of the web.config and copied TestFilter.cs to the App_Code dir of the UploadManager sample. When ShouldHandleRequest returns true now everything is fine...the progressbar is shown and the upload is done. But if I set ShouldHandleRequest to return false, the progress bar stays at 0% and nothing happens at all. Even hitting the cancel-link has no effect.
I tried to debug the problem but found nothing. But there is one thing to mention: if ShouldHandleRequest returns false, uploadManager_UploadComplete event is not fired. So are there other events (I didn't found) that are triggered, when the upload is canceled so that I'm able to give the user a feedback that his upload is not accepted? A working example extending the UploadManager sample would be very fine.
Thanks for your help,
Robert
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
The Upload Request Filter functionality in SlickUpload is to turn off SlickUpload functionality for certain pages in the application. This is used for compatibility reasons when an app needs to use both SlickUpload and built-in ASP.NET upload functionality. It sounds like this isn't the behavior you need.
What are you trying to accomplish?
|
|
|
Rank: Member
Groups: Registered
Joined: 7/27/2007 Posts: 14
|
I'm trying to disallow certain file-types (e.g. .pdf) to be uploaded and thought it could be done with that filter. Because of your HTTP-handler I can't do that after the user clicked the upload-button and before the upload is finished, can I. On the other hand I don't want to check the file-extension with javascript because that happens at the client and might be manipulated. So a filter implemented directly into SlickUpload would be very nice. There could be a black- and whitelist of file-extensions in the web.config so that SlickUpload knows which files to handle or to reject. UploadManager.UploadComplete could then have an additional state "FileRejected" which indicates, that the file(s) wasn't uploaded because of wrong file-extension. Maybe there should also be a setting how SlickUpload should react when only some files of the upload have got a wrong extension:
- reject all files if one has wrong extension - reject only the file(s) with wrong extensions
That would be a very important feature for us and I hope you can implement that or point me to a direction how to achiev that with the functions that are currently avaiable.
Thanks,
Robert
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
I'll take a look at what is necessary to implement that. Currently, you can do that yourself by creating a filename generator and throwing an exception if the file type is invalid, but that's kind of a kludge. I should have something for you by week-end.
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
I've implemented a file filter, similar to the way the request filter is implemented. Look at the UploadFileFilter sample for an example.
Basically, implement the IUploadFileFilter interface on a class. The ShouldHandleFile will be called for each file before its uploaded. If you return true, the upload will continue. If you return false, the exception will be terminated with a reason of FileFilter.
Let me know if you need any other info.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/27/2007 Posts: 14
|
Thank you for implementing that for me. I was on holiday the last two weeks and I will test your new feature within the next days and give you a feedback.
Thanks so far,
Robert
|
|
|
Rank: Member
Groups: Registered
Joined: 11/6/2005 Posts: 13
|
where is this example exactly? i need to use the functionality but cant seem to find a reference or example you mention? thanks in advance
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Look for the UploadFileFilter sample. If you need more info, let me know.
|
|
|
Rank: Member
Groups: Registered
Joined: 11/6/2005 Posts: 13
|
Chris
I am searching for this example but cannot find it? is it in Documentation, the samples downloaded with the product? a forum? a URL or explaination would be helpful if you please?
thanks
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
It should be in the standard distribution you get from the SlickUpload download page ( http://krystalware.com/Products/SlickUpload/Download.aspx)... Are you using .NET 1.1? There is only a sample for 2.0 right now. Do you need a .NET 1.1 sample?
|
|
|
Rank: Member
Groups: Registered
Joined: 11/6/2005 Posts: 13
|
sorry i didnt see this, if yoou dont mind, a 1.1 example would be quite helpful. thanks in advance!
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/30/2008 Posts: 7
|
Regarding post 3681 above (Post: IUploadRequestFilter)
We have the same issue. We want to use SlickUpload on only one page in the application. All other pages should be able to do uploads without using SlickUpload.
We need help with the implementation though.
Can you give me a little more detail on how this would work ("The ShouldHandleFile will be called for each file before its uploaded.")? How and when would this be implemented in code - on the "using slickupload" page - and - on the "not using slickupload" pages?
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
The implementation is the same pattern as the file name generator -- a seperate class that implements an interface and gets called by SlickUpload for each file to determine whether to continue the upload process. Take a look at the UploadRequestFilter/UploadRequestFilterVB samples.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/30/2008 Posts: 7
|
Many thanks, Chris, for the quick follow up. The following code worked:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
using Krystalware.SlickUpload;
public class UploadRequestFilter : IUploadRequestFilter { public bool ShouldHandleRequest(HttpRequest request) { if (HttpContext.Current.Request.RawUrl.Contains("mytestfile")) return true; else return false; } }
|
|
|
|
Guest |