Reference to the file being uploaded before the upload
Reference to the file being uploaded before the upload
Hi everyone!
I would be grateful if someone could point me to the right way of accessing filename of the file that is being uploaded before the upload action took place.
Here is my upload field definition:
{
label: 'Attachments', name: 'file',
type: "upload",
ajax: {
type: "POST",
url: "/" + modulePrefix + "-ws/attachments"
},
ajaxData: function (formData) {
formData.append("orderId", originalEntity.id);
// i want the filename right here. Is this possible without parsing the dom?
}
}
The actual reason I need it is that I use a custom server-side implementation that cannot handle UTF-8-encoded filenames correctly, it treats all characters as ISO-8859-1 thus converting national chars to '?'. So maybe there is another way of dealing with it, maybe use https://www.ietf.org/rfc/rfc2047.txt for filenames?
I would appreciate any help. Thanks in advance.
This question has an accepted answers - jump to answer
Answers
There isn't a hook in Editor for that at the moment I'm afraid. I'll confess, I'm not even sure that information is directly available in the formData object.
I suspect you'd need to modify the Editor code in order to be able to get that.
Allan