diff --git a/tinyfilemanager.php b/tinyfilemanager.php index fd73206..23ea1a4 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1,4 +1,5 @@ 'success', + 'info' => "file upload successful", + 'fullPath' => $fullPath + ); } else { $response = array ( 'status' => 'error', - 'info' => "failed to open output stream" + 'info' => "failed to open output stream", + 'errorDetails' => error_get_last() ); } + @fclose($in); @fclose($out); @unlink($tmp_name); - $response = array ( - 'status' => 'success', - 'info' => "file upload successful", - 'fullPath' => $fullPath - ); } else { $response = array ( 'status' => 'error', @@ -949,6 +954,7 @@ if (!empty($_FILES) && !FM_READONLY) { + if ($chunkIndex == $chunkTotal - 1) { rename("{$fullPath}.part", $fullPath); } @@ -1295,13 +1301,16 @@ if (isset($_GET['upload']) && !FM_READONLY) { this.on("sending", function (file, xhr, formData) { let _path = (file.fullPath) ? file.fullPath : file.name; document.getElementById("fullpath").value = _path; + xhr.ontimeout = (function() { toast('Error: Server Timeout'); }); + }).on("success", function (res) { let _response = JSON.parse(res.xhr.response); if(_response.status == "error") { + console.log(_response.errorDetails) toast(_response.info); }