This is a migrated thread and some comments may be shown as answers.
Upload .doc files only
1 Answer 16 Views
This is a migrated thread and some comments may be shown as answers.
Teena
Top achievements
Rank 1
Teena asked on 27 Feb 2013, 08:04 AM
Hi,

I am using Radasyncupload to upload .doc files in my website. I want the radasyncupload to enable uploading files with .doc extension only. If the user selects other file format, i want the control to display an alert like Unsupported file format. Can anyone help me with sample code?

Thank you,
Teena

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 27 Feb 2013, 09:16 AM
Hello Teena,

You can set the AllowedFileExtensions property of the RadAsyncUpload to ".doc" so that the user wont be able to select files with extensions other than .doc. When you set this property, files with other extensions wont be displayed in the File browser window.

RadAsyncUpload provides client-side event called OnClientValidationFailed. It is fired when the selected file has invalid extension or its size is higher than the MaxFileSize property.

ASPX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" AllowedFileExtensions="doc" OnClientValidationFailed="OnClientValidationFailed">
</telerik:RadAsyncUpload>

JavaScript:
<script type="text/javascript">
    function OnClientValidationFailed(sender, args) {
        alert("Unsupported File Format");
    }
</script>

Thanks,
Princy.
Asked by
Teena
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or