For uploads with drop zone.js, file names containing non-ascii characters will not be encoded before sent to the server. They are just left as they are:
------WebKitFormBoundaryvXgdeNXSwHZBUrFJ
Content-Disposition: form-data; name="file[0]"; filename="täst.png"
As a result, on server-side encoding is unknown.
Is there a way to force dropzone.js to UrlEncode the filename, similar to RFC 6266?
Content-Disposition: form-data; name="file[0]"; filename*=utf-8''t%c3%a4st.png
Or is there any other solution?
An example of a non-ASCII character is the Ñ. The URL can't contain any non-ASCII character or even a space.
I ran into the same problem and what I ended up doing to solve this was to pass an additional parameter.
$("#myDz").dropzone({
init: function () {
this.on("sending", function(file, xhr, formData) {
var fn = encodeURI(file.name)
formData.append("encFilename", fn);
});
}
});
This will send the additional parameter encFilename
to the backend which can then be used to name the file when it's written to disk. file.name
can't be updated at that point but doing it like this works just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With