Whenever I use AJAX to send a file to a server, the code looks like this:
$.ajax({
type: 'POST',
async: true,
crossDomain: true,
url: 'http://' + address + '/api/file/upload',
data: formData,
processData: false,
contentType: false,
headers: {
"apiKey": "myKey",
"FileName": "קובץ.txt"
},
success: function (data, textStatus, jqXHR) {}});
while everything works perfectly, if I include a Hebrew file name in the header, it triggers an error:
Error Scan fileTypeError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': Value is not a valid ByteString
The header with "FileName": "קובץ.txt"
fails to work.