<input type='file' id='fileupload' name='UploadFiles' />
<script>
var uploadObj = new ej.inputs.Uploader({
asyncSettings: {
saveUrl: '<https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',>
removeUrl: '<https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'>
},
success: onUploadSuccess,
failure: onUploadFailure
});
uploadObj.appendTo('#fileupload');
function addTokens(args) {
args.currentRequest.setRequestHeader('XSRF-TOKEN', document.getElementsByName('__RequestVerificationToken')[0].value);
}
function onUploadSuccess(args) {
if (args.operation == "upload") {
console.log("File Uploaded successfully");
}
}
function onUploadFailure(args) {
console.log("File failed to upload");
}
</script> |