This project has moved and is read-only. For the latest updates, please go here.

AllFilesFinished - too early ??

Apr 30, 2009 at 2:17 PM
Great tool, I am going to use the HTTP loader since it runs faster than the WCF.

This is what I am doing, you can tell me what I am doing wrong, or how I can do it better:

After all files are uploaded I need to create a thumbnail of each file, then copy all original files and thumbnails to a different folder (which is dynamic).

When the AllFilesFinished javascript function is called I call a server side routine to create the thumbnail and move the files.  The problem I am running into is, when I try to move the files I get the error "The process cannot access the file because it is being used by another process.".

So, what am I doing wrong ??

Thanks again, for a great tool.
May 1, 2009 at 8:35 AM

The client side javascript event is not meant to initiate server side processing.

You should do your server side processing in the FileFinished method in the WCF or HTTP uploader. This method will be executed for each finished uploaded file. So you can move it to another directory and create thumbnails. 

In the FileFinished method you also have access to the client side custom parameters. That way you can still keep it dynamic based on some user input.

May 8, 2009 at 9:15 PM
Edited May 8, 2009 at 9:16 PM

Hi, thanks for this great tool.

I also have a problem with the javascript event Allfilereceived. After the files are upload, i would like to refresh the page containing the control because in the same page, there's the file uploaded list. It'seems then js event is fired too early. Is there any workaround to solve this issue? I would like to refresh the page after the server side FileFinished method.

May 9, 2009 at 7:42 AM

Hi kalavinus,

I tried reproducing your problem on the latest code I have, but I'm not able to reproduce it.

I've set a Thread.Sleep() in the FinishedFileUpload() method, that's where you can do any after-processing after the file is uploaded. The JavaScript AllFilesFinished event triggers AFTER this method is completely finished. So everything should be finished at the server.

Can you try to reproduce your problem with the latest code from CodePlex? Or e-mail me your VS.Net project so I can reproduce it.


May 9, 2009 at 7:17 PM
Edited May 10, 2009 at 12:32 PM

I do an example:  I upload five files and when all uploads are completed js invokes allfilerecived method. In this routine i have placed : document.forms[0].submit() to force a page postback. In myfilelist i find only 4 file because allfilereceived is invoked when the requests finishes and not when  all files are saved. If i refresh anoither time , the files are all showed.

 I also have tryed to use a js timeout of 10 secs before submitting form but the result is the worst.