i have this problem:
i have this tag for upload a file
<div id="form-attachments"> <input type="file" name="attachFile" id="attachFile"/> </div>
and i recover the value like this
$("#attachFile").change(function () {
var file = document.getElementById('attachFile').files[0];
uploadFile(file);
});
function uploadFile(file) {
var formData = new FormData();
formData.append('file', file);
formData.append('IDNotifica', $('#IDNotifica').val());
formData.append('relata', $('#fileTipoRelata').val());
var filename = $('input[type=file]').val().split('\').pop();
//var bool = checkNome(filename);
//if (!bool)
// return false;
$("#loadingFile").fadeIn();
$.ajax({
url: $('#PathAggiungiAllegati').val(), //Server script to process data
type: 'POST',
//contentType: "application/json; charset=iso-8859-1",
xhr: function () { // Custom XMLHttpRequest
var myXhr = $.ajaxSettings.xhr();
if (myXhr.upload) { // Check if upload property exists
myXhr.upload.addEventListener('progress', progressHandlingFunction, false); // For handling the progress of the upload
}
return myXhr;
},
//Ajax events
beforeSend: beforeSendHandler,
success: completeHandler,
error: errorHandler,
// Form data
data: formData,
//Options to tell jQuery not to process data or worry about content-type.
cache: false,
contentType: false,
processData: false,
//beforeSend: function (jqXHR) {
// jqXHR.overrideMimeType('application/json;charset=iso-8859-1');
//}
});
}
Windows is ok, but in MAC OS, when the value of file uploaded arrive at server, i have a check control for block a file with special char (also accetented letters) but this check don’t detect the accented letters from Mac Client.
I have try more methods(convert to utf8, change charset, insert a check control at client side ecc..) but i think that the problem live in tag `
(this problem is present only on Firefox and Chrome, in Safari is ok)
<div id="form-attachments">
<input type="file" name="attachFile" id="attachFile"/>
</div>`
Can you help me please?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Everything is described precisely in Stackoverflow post:
Strange font encoding in all browsers
In general this website does not render correctly in Firefox whereas in Chrome it is okay:
https://goout.net/cs/muzea/apple-museum/wucb/
Actual results:
The font is rendered incorrectly.
Expected results:
The font should be rendered correctly.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0