Single file size

Thread is closed for posting
4 posts, 0 answers
  1. Mansi
    Mansi avatar
    63 posts
    Member since:
    Feb 2009

    Posted 18 Oct 2011 Link to this post


    I am using radUpload to upload multiple files at a time. I need to check file's size each time user selects a file. For that using "onclientfileselected="selectedFile" in radUpload control.

    Below is the code in "selectedFile" javascript function.

      var inputs = sender.getFileInputs();
      size = inputs[i].files[0].fileSize;

    But it shows "size" undefined.
    Before some days, I was getting correct size, but now it is not working. I've not updated Telerik's version or anything like that. What could cause this kind of issue?

    Please reply at the earliest as it is live on the site.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Oct 2011 Link to this post

    Hello Manasi,

    The information about the file sizes is not available on the client until files are uploaded. The value is available only once upload begins. You could hook OnClientProgressUpdating and can access the size.

    Please take a look into the following help article.
    Checking File Size on the Client.

  3. Mansi
    Mansi avatar
    63 posts
    Member since:
    Feb 2009

    Posted 18 Oct 2011 Link to this post

    It's very strange. How it was working till now? It was very well updating the lables below the radupload for the sizes at each file selection.

    Do you mean that there isn't anything like which could get a selected file's size?
      size = inputs[i].files[0].fileSize;
    There is not ".fileSize" property available???? If no than was that in old version?

    Till now it was not even throwing any JavaScript bug even and was working very well!!
  4. Peter Filipov
    Peter Filipov avatar
    1028 posts

    Posted 23 Oct 2011 Link to this post

    Hi Mansi,

    The mentioned functionality is available only in browsers which supports FileApi. To validate file's size on the client side, please use RadAsyncUpload control.

    Kind regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top