mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2025-07-29 21:10:41 +02:00
Add JSON Parse Error Handling in Upload Script (#1196)
* Add JSON Parse Error Handling in Upload Script * Update tinyfilemanager.php * Update tinyfilemanager.php
This commit is contained in:
@@ -1398,10 +1398,14 @@ if (isset($_GET['upload']) && !FM_READONLY) {
|
|||||||
toast('Error: Server Timeout');
|
toast('Error: Server Timeout');
|
||||||
});
|
});
|
||||||
}).on("success", function (res) {
|
}).on("success", function (res) {
|
||||||
let _response = JSON.parse(res.xhr.response);
|
try {
|
||||||
|
let _response = JSON.parse(res.xhr.response);
|
||||||
|
|
||||||
if(_response.status == "error") {
|
if(_response.status == "error") {
|
||||||
toast(_response.info);
|
toast(_response.info);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
toast("Error: Invalid JSON response");
|
||||||
}
|
}
|
||||||
}).on("error", function(file, response) {
|
}).on("error", function(file, response) {
|
||||||
toast(response);
|
toast(response);
|
||||||
|
Reference in New Issue
Block a user