- Allow Extension
- Deny Extension
Contact Support
Restricting uploading files based on its extension
28 Jun 20172 minutes 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 steps explain the configuration of extensionsAllow property in Uploadbox.
In the HTML page, add the <div> element to configure the Uploadbox element.
<div id="Uploadbox" ej-uploadbox e-saveurl="save" e-removeurl="remove" e-extensionsallow="allow"></div>
angular.module('UploadboxApp', ['ejangular'])
.controller('UploadboxCtrl', function ($scope) {
$scope.save = "saveFiles.ashx";
$scope.remove = "removeFiles.ashx";
$scope.allow = ".docx, .pdf";
});
For JS, configure saveFiles.ashx and removeFiles.ashx files as mentioned in the Save file action and Remove file action respectively.
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 steps explain the configuration of extensionsDeny property in Uploadbox
In the HTML page, add the <div> element to configure the Uploadbox element.
<div id="Uploadbox" ej-uploadbox e-saveurl="save" e-removeurl="remove" e-extensionsdeny="deny"></div>
angular.module('UploadboxApp', ['ejangular'])
.controller('UploadboxCtrl', function ($scope) {
$scope.save = "saveFiles.ashx";
$scope.remove = "removeFiles.ashx";
$scope.deny = ".docx,.pdf";
});
For JS, configure saveFiles.ashx and removeFiles.ashx files as mentioned in the Save file action and Remove file action respectively.