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.
Hello how to repair this error for UTF8 filenames?
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>