|
|
Rank: Member
Groups: Registered
Joined: 7/6/2009 Posts: 17 Location: nyc
|
Hi,
I used to use this:
Krystalware.SlickUpload.HttpUploadModule.GetUploadedFiles()
Now it won't build with version 6.0.7. How do I update this code?
Thanks!
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
HttpUploadModule has become SlickUploadModule. The specific methods for getting things like uploaded files have been moved into a separate class called SlickUploadContext.
So, to retrieve the files uploaded in the current session, you'd do something like this:
ICollection<UploadedFile> uploadedFiles = SlickUploadContext.CurrentUploadSession.UploadedFiles;
There may be easier ways to get access to the files, though -- we haven't recommended accessing them directly like that for awhile unless you're not using the standard SlickUpload client controls. If you're using the ASP.NET WebForms controls, you can get the current upload session through the UploadComplete event. If you're using MVC or Razor, you can get the current upload session by using model binding.
Looking at the quickstart guide or samples may help. We're actively working on the upgrade guide, and have the generalites fleshed out, but we want to fill in all of the little details to make sure nothing is confusing.
Don't hesitate to let me know if you have any other questions during this process.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/6/2009 Posts: 17 Location: nyc
|
Thanks for the clarification! I used to use Krystalware.SlickUpload.HttpUploadModule.GetUploadedFiles() to accept a file in byte array and from Flash form value.
I have a bunch of ways to upload files, some I can switching to use kw.UploadConnector because of your recommendation. But is using a FileUploadStreamProviderthe the only way to capture each file uploaded in order to process them on the server side? If I don't use it and just set in web.config uploadStreamProvider type="File", I can't manipulate the files uploaded on the server side? I am wondering what overhead does using a FileUploadStreamProvider have?
Thanks!
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Ahh, cool.
What kind of processing are you trying to do? I'm not sure I understand your question -- FileUploadStreamProvider and uploadStreamProvider type="File" are one and the same. The FileUploadStreamProvider overhead is very low -- it just does a little logic for each file to determine what type it is, and then returns a FileStream object for SlickUpload to write the data.
Have you seen this post? It describes a couple of ways to set up handlers that process files from different sources: http://krystalware.com/forums/yaf_postsm5406_Slickupload-6-with-uploadFilter-and-different-handler.aspx#post5406
|
|
|
Rank: Member
Groups: Registered
Joined: 7/6/2009 Posts: 17 Location: nyc
|
Oh I am trying to resize the uploaded images and save the result in a new location (path determined by MD5 of the file).
I read the thread you showed me and that was informative. I can just keep my old handler and do <location path="UploadHandler.axd"> then. Sorry I thought the new way is to use FileUploadStreamProvider.
So is there a difference between using a StreamProvider and an HttpHandler? In my case, which would you recommend?
Thanks!
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
I would recommend using the UploadStreamProvider method (resizing in CloseWriteStream if isComplete=true) because this provides the simplest way to centralize that processing code. That way, no matter where the uploads are from (SlickUpload controls, a flash control, or other upload process), as long as they hit that upload stream provider they will be handled.
Keep in mind (like I mentioned on the other thread) that if you aren't using the SlickUpload controls for an upload, you'll need to manually commit the session in your handler so that it won't be considered stale and rolled back. Something like this:
protected void Page_Load(object sender, EventArgs e) { UploadSession session = SlickUploadContext.CurrentUploadSession;
if (session != null && session.UploadedFiles.Count > 0) { SlickUploadContext.CommitSession(session); } else { // TODO: handle no upload } }
|
|
|
|
Guest |