@{
var asyncSettings = new Syncfusion.EJ2.Inputs.UploaderAsyncSettings { SaveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Save", RemoveUrl = "https://ej2.syncfusion.com/services/api/uploadbox/Remove" };
}
<ejs-uploader id="uploadFiles" asyncSettings="@asyncSettings" autoUpload="false"></ejs-uploader>
<button id="myBtn">Enable/Disable</button>
<script>
var uploadObj;
var isEnabled = true;
document.addEventListener('DOMContentLoaded', function () {
document.getElementById("myBtn").addEventListener("click", ClickHandler);
uploadObj = document.getElementById("uploadFiles").ej2_instances[0];
})
function ClickHandler() {
if (uploadObj.enabled) {
uploadObj.enabled = false;
} else {
uploadObj.enabled = true;
}
}
</script> |
hi how we not allowed to upload specific file extension for user from file uploader
Hi Aman,
To restrict specific file extensions, you can use the 'allowedExtensions' property of the uploader component. This property allows you to specify the extensions of the file types allowed and separate them with commas. For example, if you only want to allow image files with extensions '.jpg' and '.png', you can set the allowedExtensions property to “.jpg,.png”.
For more information on this topic, please refer to below documentation and API reference.
Documentation : https://ej2.syncfusion.com/aspnetcore/documentation/uploader/validation#file-type
API Reference :
allowedExtensions
Regards,
Mallesh