]> git.mxchange.org Git - simple-upload.git/commitdiff
Return file name or FALSE on error.
authorRoland Häder <roland@mxchange.org>
Wed, 30 Mar 2016 08:30:29 +0000 (10:30 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 30 Mar 2016 08:30:57 +0000 (10:30 +0200)
index.php

index 02f1f0f2408ced86ec5770e5432c13d8dc820320..612d74de41b0d42a212cc69102e380977db45fff 100644 (file)
--- a/index.php
+++ b/index.php
                // 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
                        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;
                }
        }