i am silly

This commit is contained in:
Lee 2023-04-09 17:37:56 +01:00
parent bdf583f21f
commit 7ecf840d40

@ -63,7 +63,7 @@ try {
if (!checkToken($token)) { if (!checkToken($token)) {
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'message' => 'Invalid or missing upload secret', 'url' => 'Invalid or missing upload secret',
// Remove this if you don't want to show the support URL // Remove this if you don't want to show the support URL
'support' => "For support, visit - https://git.fascinated.cc/Fascinated/sharex-php-uploader", 'support' => "For support, visit - https://git.fascinated.cc/Fascinated/sharex-php-uploader",
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
@ -75,7 +75,7 @@ try {
if (!isset($file)) { if (!isset($file)) {
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'message' => 'No file was uploaded', 'url' => 'No file was uploaded',
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
die(); die();
@ -88,7 +88,7 @@ try {
if (file_exists($uploadDir . $target_file)) { if (file_exists($uploadDir . $target_file)) {
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'message' => 'File already exists', 'url' => 'File already exists',
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
die(); die();
@ -115,13 +115,13 @@ try {
if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $uploadDir . $finalName)) { if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $uploadDir . $finalName)) {
returnJson(array( returnJson(array(
'status' => 'OK', 'status' => 'OK',
'message' => 'File uploaded successfully', 'url' => 'File uploaded successfully',
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
} else { } else {
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'message' => 'Failed to save file. Check the permissions of the upload directory.', 'url' => 'Failed to save file. Check the permissions of the upload directory.',
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
} }
@ -129,14 +129,14 @@ try {
} }
returnJson(array( returnJson(array(
'status' => 'OK', 'status' => 'OK',
'message' => 'File uploaded successfully', 'url' => 'File uploaded successfully',
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
die(); die();
} catch (Exception $e) { // Handle any errors } catch (Exception $e) { // Handle any errors
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'message' => $e->getMessage(), 'url' => $e->getMessage(),
'timeTaken' => getTimeTaken() 'timeTaken' => getTimeTaken()
)); ));
die(); die();