Dropzone Js Change Filename Before Upload
I'm using Dropzone.js to handle uploading of files. I would really like to be able to modify the original name of the file before uploading it to S3. It would be nice to just be ab
Solution 1:
File is a HTML 5 file object, and some of it's properties is read-only as you can see here
But, you can set a new property for your file object like:
myDropone.on("sending", function(file) {
file.myCustomName = "my-new-name" + file.name;
console.log(file.myCustomName);
});
Edit: Also, the documentation says, the recommended way to send aditional params in the body of the post action is:
myDropzone.on("sending", function(file, xhr, formData) {
// Will send the filesize along with the file as POST data.
formData.append("filesize", file.size);
formData.append("fileName", "myName");
});
Hope it helps.
Post a Comment for "Dropzone Js Change Filename Before Upload"