This project is read-only.


Client Side Upload Completed Event

I just tried the sample and it worked perfectly. Is it possible to return some data back to that client-side when individual file upload is completed? What I need is that at each file upload completion, I add a record in the database and send that new record back to the client-side to be displayed in a DataGrid. Currently what I see is that there is only one "Completed" event available at client-side which occurs at the upload completion of ALL files, not for individual files. Also I can't find a way to transfer any data from UploadComplete function of UploadHandler class. Kindly explain that how can I acheive these things.
Closed Jul 22, 2011 at 10:56 PM by hyspdrt


w0rddriven wrote Jul 14, 2011 at 4:21 PM

What are you trying to achieve, exactly? Are you trying to make sure every single file uploaded correctly on an individual basis or is there some other need?

I'm asking because there's quite a few ways to trick these things into being. I currently use the UploadHandler to write files to the database, well specifically to the Upload folder first then stream those contents into the database so I'm doing pretty much exactly what you are.

The major difference I likely have with your implementation is I use a ChildWindow upload dialog pass-through of sorts where I handle most of the Browse functionality there and I use the Completed event to inspect the dialog and then close the ChildWindow when every file is complete. Once the parent window returns I just requery the datagrid contents on successful upload, I don't bother to pass record Ids back at all.

My completed event may help you get started on something so hopefully codeplex won't mangle this:
_uploadFileDialog.Completed += (s, e) =>
_uploadFileDialog.Files.ToList().ForEach(item =>
    if (item.IsCompleted == false)
         _isUploadFailed = true;
if (!_isUploadFailed)
    CanOK = true;

This basically mimics AutoClose by only closing the dialog when I've made sure all the files have IsCompleted = true. I know it doesn't directly address the situation you're in but hopefully this would get you started.

wrote Jul 22, 2011 at 10:56 PM

Resolved with changeset 68155.

wrote Feb 14, 2013 at 7:39 PM

wrote May 16, 2013 at 9:40 AM

wrote Dec 1 at 2:16 AM