3 Answers, 1 is accepted
0
Hello Kennet,
Thank you for your interest in the RadUpload control.
The upload control provide some basic filters right of the box - MaxFileCount, MaxFileSize, MaxUploadSize. If you need some more sophisticated filter then you should rely on the FileSelected event - here you can access the FileInfo structure for all the selected files. In the attached example we are filtering against the minimum size of 4kB.
Please give it a try and let us know if there are more questions.
Sincerely yours,
Ivan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you for your interest in the RadUpload control.
The upload control provide some basic filters right of the box - MaxFileCount, MaxFileSize, MaxUploadSize. If you need some more sophisticated filter then you should rely on the FileSelected event - here you can access the FileInfo structure for all the selected files. In the attached example we are filtering against the minimum size of 4kB.
Please give it a try and let us know if there are more questions.
Sincerely yours,
Ivan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kennet
Top achievements
Rank 2
answered on 28 Sep 2009, 04:27 PM
Thanks,
But is there any way to access the file from Silverlight before uploading it, I can't get the path for the file?
In this case I want to read some info from a MP3 file, like the bitrate, and only upload files with a certain bitrate.
The MP3 Class is found here:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=79
But is there any way to access the file from Silverlight before uploading it, I can't get the path for the file?
In this case I want to read some info from a MP3 file, like the bitrate, and only upload files with a certain bitrate.
for (int index = e.SelectedFiles.Count; index-- > 0; ) |
{ |
RadUploadSelectedFile file = e.SelectedFiles[index]; |
MP3Header mp3hdr = new MP3Header(); |
bool boolIsMP3 = mp3hdr.ReadMP3Information(file.File.Name); |
if (boolIsMP3) |
{ |
lbox1.Items.Add(mp3hdr.strFileName); |
lbox1.Items.Add(mp3hdr.lngFileSize.ToString()); |
lbox1.Items.Add(mp3hdr.intBitRate.ToString()); |
lbox1.Items.Add(mp3hdr.intFrequency.ToString()); |
lbox1.Items.Add(mp3hdr.strMode); |
lbox1.Items.Add(mp3hdr.strLengthFormatted); |
lbox1.Items.Add(mp3hdr.intLength.ToString()); |
lbox1.Items.Add("==========================="); |
} |
} |
The MP3 Class is found here:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=79
0
Accepted
Hello Kennet,
In the Silverlight environment you can not access the file's full name - this is a security limitation of the Framework. The good news is that there is a way to read data from a local file - you should operate in FilesUpload even handler - relying on the FileInfo structure (supplied by the Silverlight). Below is a sample code:
We hope this information will help you.
Best wishes,
Ivan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
In the Silverlight environment you can not access the file's full name - this is a security limitation of the Framework. The good news is that there is a way to read data from a local file - you should operate in FilesUpload even handler - relying on the FileInfo structure (supplied by the Silverlight). Below is a sample code:
private void radUpload_FilesSelected(object sender, FilesSelectedEventArgs e) |
{ |
foreach (RadUploadSelectedFile radFile in e.SelectedFiles) |
{ |
FileInfo fileInfo = radFile.File; |
Stream fileStream = fileInfo.OpenRead(); |
long fileSize = fileStream.Length; |
int bufferSize = 4096; |
byte[] buffer = new byte[bufferSize]; |
for (int position = 0; position < fileSize; ) |
{ |
int delta = fileStream.Read(buffer, position, bufferSize); |
if (delta > 0) |
{ |
// Process your data here; |
} |
position += delta; |
} |
fileStream.Close(); |
} |
} |
We hope this information will help you.
Best wishes,
Ivan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.