Server side processing multiple files

8 posts, 0 answers
  1. Mark
    Mark avatar
    4 posts
    Member since:
    May 2009

    Posted 10 Dec 2010 Link to this post

    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()
            If Me.IsFinalFileRequest Then

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

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

    Mark Richards
  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 15 Dec 2010 Link to this post

    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
  3. Hans
    Hans avatar
    28 posts
    Member since:
    Mar 2011

    Posted 29 Mar 2011 Link to this post

    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.
  4. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 01 Apr 2011 Link to this post

    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
  5. Luke
    Luke avatar
    12 posts
    Member since:
    Mar 2011

    Posted 11 Apr 2011 Link to this post


    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.

    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()
                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.
  6. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 14 Apr 2011 Link to this post

    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
  7. Lee
    Lee avatar
    3 posts
    Member since:
    Dec 2013

    Posted 01 May 2015 in reply to Tina Stancheva Link to this post


    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?



  8. Kiril Vandov
    Kiril Vandov avatar
    324 posts

    Posted 04 May 2015 Link to this post

    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(() =>
    Please let us know if this works for you.

    Kind regards,
    Kiril Vandov

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

Back to Top