I am using filedrop.js to upload files (.net mvc razor).
I want to rename the file based on a hidden form field value upon file upload.
There is a rename function, but I don't know how to pass the new name, field value to it.
Here is the code on the page:
<script src="~/Scripts/filedrop.js"></script>
<script type="text/javascript">
$(function () {
$("#dropSection").filedrop({
fallback_id: 'btnUpload',
fallback_dropzoneClick: true,
url: '@Url.Action("Upload")',
//allowedfiletypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/doc'],
allowedfileextensions: ['.ics', '.docx', '.pdf', '.jpg', '.jpeg', '.png', '.gif'],
paramname: 'fileData',
maxfiles: 25, //Maximum Number of Files allowed at a time.
maxfilesize: 2, //Maximum File Size in MB.
dragOver: function () {
$('#dropSection').addClass('active');
},
dragLeave: function () {
$('#dropSection').removeClass('active');
},
drop: function () {
$('#dropSection').removeClass('active');
},
uploadFinished: function (i, file, response, time) {
$('#uploadedFiles').append(file.name + '<br />')
},
afterAll: function (e) {
//To do some task after all uploads done.
}
})
})
</script>
}