Upload .doc files only

2 posts, 1 answers
  1. Teena
    Teena avatar
    16 posts
    Member since:
    Feb 2013

    Posted 27 Feb 2013 Link to this post


    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,
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Feb 2013 Link to this post

    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.

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

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

Back to Top