Accessing uploaded file size?

2 posts, 0 answers
  1. Charles
    Charles avatar
    32 posts
    Member since:
    Mar 2008

    Posted 13 Feb 2009 Link to this post


    I noticed in the silverlight upload control that when a file is selected on the client, the file size displays in the control.

    Is it possible to obtain the length of the file in bytes in the upload handler as its being uploaded? Is it in some dictionary object ?

  2. Ivan
    Ivan avatar
    519 posts

    Posted 16 Feb 2009 Link to this post

    Hi Charles,

    Thank you for contacting Telerik Support.

    We verified that the file size is not sent to the upload handler. We consider this to be a valuable addition and will update the RadUpload to do support it.

    Currently, you can work the issue around by using a custom parameter to send the file size value. To accomplish this task you should follow the following two steps:

    1. Add the FileUploadStarting event handler (for RadUpload control) where the custom parameter (with the value of the file size) will be supplied:

    public partial class Page : UserControl 
       private void RadUpload_FileUploadStarting(object sender, 
             Telerik.Windows.Controls.FileUploadStartingEventArgs e) 

    2. Override the ProccessStream method (in the upload handler) and process the custom parameter:

    public class MyRadUploadHandler : Telerik.Windows.RadUploadHandler 
       public override void ProcessStream() 
          string sFileSize = this.Request.Form["customTag_FileSize"]; 
          if (sFileSize != null
             long fileSize = 0; 
             if (long.TryParse(sFileSize, out fileSize)) 
                // here we can rely on the value in fileSize. 

    Please give it a try and let me know if there are more questions.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top