Restricting uploading files based on its extension

12 Apr 20171 minute to read

Allow Extension

Files are filtered before they are uploaded. You can select the files to be filtered by using browse button. The ExtensionsAllow property allows upload of the selected extensions only. You can give multiple extensions by using comma (,). The data type is string.

NOTE

Prepend dot (.) symbol with extension like “.pdf”.

The following code helps you for the configuration of ExtensionsAllow property in UploadBox.

  • CSHTML
  • <ej-upload-box id="UploadDefault" save-url="//mvc.syncfusion.com/Services/FileUpload/UploadBox/saveFiles" remove-url="//mvc.syncfusion.com/Services/FileUpload/UploadBox/removeFiles" extensions-allow=".docx,.pdf"></ej-upload-box>

    Deny Extension

    Files are filtered before they are uploaded. You can select the files to be filtered by using browse button. The ExtensionsDeny property denies upload of the selected extensions. You can give multiple extensions by using comma (,). The data type is string.

    NOTE

    Prepend dot (.) symbol with extension like “.pdf”.

    The following code helps you for the configuration of ExtensionsDeny property in UploadBox

  • CSHTML
  • <ej-upload-box id="UploadDefault" save-url="//mvc.syncfusion.com/Services/FileUpload/UploadBox/saveFiles" remove-url="//mvc.syncfusion.com/Services/FileUpload/UploadBox/removeFiles" extensions-deny=".docx,.pdf"></ej-upload-box>

    NOTE

    When ExtensionsDeny and ExtensionsAllow properties have same file extension, the extension will be allowed.