|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
I have implemented IFileNameGenerator and set the web.config correct. In FileNameGenerator, I create a directory and filename. The directory is created successfully, but the file itself is never written. I have tried in several different locations on my system, all with the same results: the directories are successfully created, but the file is never wirtten.
I am using ASP.NET MVC 2
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Can you post the code for your FileNameGenerator, or email it to me at chris at krystalware.com?
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
Chris...
I sent the file. Just making sure you got it.
Vincent
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
I've got it. Here is the problem:
string uploadPathFull = request.Form["UploadPathFull"];
string uploadPath = request.Form["UploadPath"];
These two lines access the Request.Form collection. The problem is that when you access the form collection, ASP.NET loads the entire request (as the form values are interspersed with files), keeping SlickUpload from intercepting the upload. Where is this value coming from? Is it possible to calculate it from the logged in user or some other value? If not, you've got a couple of other options:
- Put it in the UploadInformation property, and get it out via HttpUploadModule.GetUploadStatus().UploadInformation
- Put it in the upload url by setting the UploadUrl property to "~/SlickUpload.axd?uploadPath=bla", and then pull it out using request.QueryString
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
Perfect! Thanks very much.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
It seems that UploadInformation is cleared if the file is cleared and a new file resubmitted. How do I ensure that UploadInformation is not cleared? Or how do I refresh it's value?
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
Incidentally, if I use the QueryString technique, I get a "Save File Dialog" asking where to save SlickUpload.axd
UploadUrl="~/SlickUpload.axd?uploadPath=myPath&"
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Are you trying to upload the files with SlickUpload and then submit the form with jQuery? Or...?
Is it possible to send me a project that reproduces the issue? If that's too much work, at least the .aspx, server side code, and javascript you're using. That'll help me see exactly what you're doing so I can suggest a fix.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
When the user adds a file for upload, the file is submitted upon being added by JQuery. Then the user submits the rest of the form. Does that make sense?
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
That makes sense, yes, but I'd still like to look at your code if possible -- the devil is in the details. SlickUpload 5 has some quirks when you try to use it in an AJAX fashion, especially if you're trying to reuse a control for multiple uploads.
SlickUpload 6 should solve all of these issues, but it's not quite done yet -- the alpha should be out later this month.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/11/2011 Posts: 7
|
OK... I just sent the code. Thanks.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/6/2009 Posts: 17 Location: nyc
|
Is the Request.Form collection accessable when inheriting from FileUploadStreamProvider, because I don't have access to HttpContext?
I am using a HttpHandler now and accessing Request.Form collection while uploading each file. Form values such as each image's privacy setting, albumId, tag names, and insert these data along with UploadedFile file size, width, height of the image in the database at the same time the corresponding image is being uploaded and saved.
So sounds like UploadInformation doesn't work because it gets cleared each time a file is uploaded? I can't put them in the querystring because there are too many things.
Also you're saying it's inefficient to access the Request.Form collection and it intercepts the upload. Does that mean I would just access Request.Form collection once after looping through each SlickUploadContext.CurrentUploadSession.UploadedFiles instead of accessing it inside the loop, but still do that all in the same request? Or should I only access the form in a totally separate request?
Thanks!
|
|
|
Rank: Administration

Groups: Administrators
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Are you running into issues with your HttpHandler, or just wondering about the most optimal way to implement that functionality?
In your case, you should be able to access Request.Form just fine because you're posting to a custom handler using SlickUpload. HttpHandler functionality (and all page functionality) occurs after SlickUpload intercepts and processes the upload. The issue with using Request.Form occurs when you use it in an HttpModule that hooks in before SlickUpload, or use it an UploadStreamProvider (as upload stream providers are called at the beginning of each file, before an upload is fully processed, so that they can provide a stream to which to write the file).
|
|
|
|
Guest |