verot / class.upload.php

This PHP class uploads files and manipulates images very easily. It is in fact as much as an image processing class than it is an upload class. Compatible with PHP 4, 5, 7 and 8. Supports processing of local files, uploaded files, files sent through XMLHttpRequest.
http://www.verot.net/php_class_upload.htm
GNU General Public License v2.0
853 stars 359 forks source link

String contains non ISO-8859-1 code point. #147

Closed xkpx64 closed 3 years ago

xkpx64 commented 3 years ago

Hello how to repair this error for UTF8 filenames?

Capture

Error seems to happen here. <html> window.onload = function () { function xhr_send(file, status, progress) { if (file) { xhr.addEventListener('readystatechange', function(event) { if(xhr.readyState == 4){ document.getElementById(status).innerHTML = xhr.responseText; } }, false); xhr.upload.addEventListener("progress", function (event) { if (event.lengthComputable) { self.progress = event.loaded / event.total; } else if (this.explicitTotal) { self.progress = Math.min(1, event.loaded / self.explicitTotal); } else { self.progress = 0; } document.getElementById(progress).innerHTML = ' ' + Math.floor(self.progress*1000)/10 + '%'; document.getElementById(progress).style.width= self.progress*100 + '%'; }, false); xhr.open("POST", "upload_handle.php?action=xhr"); xhr.setRequestHeader("Cache-Control", "no-cache"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("X-File-Name", file.name); xhr.send(file); } } function xhr_parse(file, status) { if (file) { document.getElementById(status).innerHTML = "<b>" + file.name + "(" + file.type + ", " + file.size + ") </b> / xkpJsCall"; } else { document.getElementById(status).innerHTML = "Не сте избрали файл!"; } } var xhr = new XMLHttpRequest(); if (xhr && window.File && window.FileList) { // xhr example var xhr_file = null; document.getElementById("xhr_field").onchange = function () { xhr_file = this.files[0]; xhr_parse(xhr_file, "xhr_status"); } document.getElementById("xhr_upload").onclick = function (e) { e.preventDefault(); xhr_send(xhr_file, "xhr_result", "xhr_progress"); } } } </html>

verot commented 3 years ago

Can you try the new code on master?

xkpx64 commented 3 years ago

Working Thank You Sir!