From: Roland Häder Date: Wed, 30 Mar 2016 08:30:29 +0000 (+0200) Subject: Return file name or FALSE on error. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5a5cb5eb0c9a0de97c0fcd8b9a1c476963e081e6;p=simple-upload.git Return file name or FALSE on error. --- diff --git a/index.php b/index.php index 02f1f0f..612d74d 100644 --- a/index.php +++ b/index.php @@ -185,7 +185,7 @@ // Do now allow to overwriting files if (isReadableFile($file_data['upload_target_file'])) { echo 'File name already exists' . "\n"; - return; + return false; } // Moving uploaded file OK @@ -193,8 +193,12 @@ if ($settings['allow_deletion'] || $settings['allow_private']) $_SESSION['upload_user_files'][] = $file_data['target_file_name']; echo $settings['url'] . $file_data['target_file_name'] . "\n"; + + // Return target file name for later handling + return $file_data['upload_target_file']; } else { echo 'Error: unable to upload the file.'; + return false; } }