This is a migrated thread and some comments may be shown as answers.

Server side processing multiple files

7 Answers 99 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 10 Dec 2010, 10:04 PM
I have a Silverlight control using the RadUpload, with support for multiple files.  On the server side, I do some custom processing when the file is uploaded.  I have code in ProcessStream that should run for each file, however, it only runs for the last file.  I check IsFinalFileRequest, which the docs seem to indicate should be true at the end of each individual file.  However, it is only true at the end of the last file.  So, if I upload 3 files, the first 2 get written to disk on the server, but my code only runs for the last file.

    Overrides Sub ProcessStream()
        MyBase.ProcessStream()
        If Me.IsFinalFileRequest Then

            '.... custom server side processing on Me.GetFileName
        End If


Is there some other field besides IsFinalFileRequest I should be checking?

Thanks,
Mark Richards

7 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 15 Dec 2010, 01:45 PM
Hello Mark,

IsFinalFileUpload is generally what you need to check. Which version of the control are you using? What processing do you perform on the stream? Is it possible to use SaveChunkData or GetAssociatedDate methods instead as the documentation recommends?

Best wishes,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Hans
Top achievements
Rank 1
answered on 29 Mar 2011, 01:02 PM
I have the same issue both IsFinalFileRequest and IsFinalUploadRequest are called only at the end of the last uploaded file.
And I also need to run some code after each uploaded file.
0
Tina Stancheva
Telerik team
answered on 01 Apr 2011, 08:28 AM
Hello Hans,

I am not sure which version of the controls you are using and how you implement your scenario. However, there is a knoledge base article that might help you - How to process files on the server. Please have a look a it and let us know if it helps or if your scenario requires a different approach.

Kind regards,
Tina Stancheva
the Telerik team
0
Luke
Top achievements
Rank 1
answered on 11 Apr 2011, 08:22 PM
Hi,

I'm having same problem. I wonder if anyone has solved this yet as it isn't consistent with documentation. I'll try and implement given tutorial for "Processing files on the server". 

UPDATE: I managed to get the logic working. I pass a parameter with file names to handler and when isFinalFileRequests is true at the end of last file i go through this parameter and work through all files. However I have a problem with isFinalFileRequest() method. If I have more than one file uploading it always throws an AccessViolationException.

System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  InnerException: 

No StackTrace or any hints. However, I was able to pinpoint it to isFinalFileRequest() method. Any ideas why would it be throwing this exception? and why only when multiple files are being uploaded; works fine with single file.

public override void ProcessStream()
        {
            base.ProcessStream();
 
            if (this.IsFinalFileRequest())
            {
                // Suppose to be called on every single file.
                // I file name is being changed and file is being put on sharepoint drive.
            }
        }
0
Tina Stancheva
Telerik team
answered on 14 Apr 2011, 05:55 PM
Hi Luke,

This is a known issue. The exception is actually raised by the FileUploadStarting() event when you try to save the e.SelectedFile properties into visual element in the page. If this is your scenario as well, you can try to save the SelectedFile information in data items instead.

The issue is logged in our PITS where you can track its progress.

All the best,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Lee
Top achievements
Rank 1
answered on 01 May 2015, 08:21 AM

Hi, 

This is still happening for me when I try and cancel the upload inside the FileUploadStarting() event using RadUpload.CancelUpload();

Is this part of the same issue?

Thanks,

Lee

0
Kiril Vandov
Telerik team
answered on 04 May 2015, 08:05 AM
Hello Lee,

This is the same issue and it still reproducible with our binaries. The cause for the issue is that the uploads are started in a UploaderDispatcher and the canceling is called to early. Until the issue is resolved you could call the CancelUpload() method inside a dispatcher, this should solve the issue:
this.Dispatcher.BeginInvoke(new Action(() =>
{
    upload.CancelUpload();
}));
Please let us know if this works for you.

Kind regards,
Kiril Vandov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Upload
Asked by
Mark
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Hans
Top achievements
Rank 1
Tina Stancheva
Telerik team
Luke
Top achievements
Rank 1
Lee
Top achievements
Rank 1
Kiril Vandov
Telerik team
Share this question
or