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

Single file size

3 Answers 53 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Mansi
Top achievements
Rank 1
Mansi asked on 18 Oct 2011, 10:40 AM
Hi,

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.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Oct 2011, 11:28 AM
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.

Thanks,
Princy.
0
Mansi
Top achievements
Rank 1
answered on 18 Oct 2011, 11:39 AM
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!!
0
Peter Filipov
Telerik team
answered on 23 Oct 2011, 12:48 PM
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
Tags
Upload (Obsolete)
Asked by
Mansi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mansi
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or