diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 55b41054..8f621a94 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1398,10 +1398,14 @@ function getUploadExt() { toast('Error: Server Timeout'); }); }).on("success", function (res) { - let _response = JSON.parse(res.xhr.response); + try { + let _response = JSON.parse(res.xhr.response); - if(_response.status == "error") { - toast(_response.info); + if(_response.status == "error") { + toast(_response.info); + } + } catch (e) { + toast("Error: Invalid JSON response"); } }).on("error", function(file, response) { toast(response);