From: muchweb Date: Tue, 23 Sep 2014 12:41:32 +0000 (+0100) Subject: Added debug information display X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c5392ea837db27c28f383054bc8a6a1fbbbfaed4;p=simple-upload.git Added debug information display --- diff --git a/README.md b/README.md index 98099c3..06717be 100644 --- a/README.md +++ b/README.md @@ -12,22 +12,25 @@ Just drop a PHP file in any directory. It will work straight away There are few options that you can change by editing the file itself: -- `$settings['uploaddir'] = '.';` +- `uploaddir => '.'` Directory to store the uploaded files. Defaults to rurrect script directory -- `$settings['listfiles'] = true;` +- `listfiles => true` Option that will list all files in uploads directory. Enabled by default +- `debug => false` + To display debugging information + ## Usage options - Through interface: - - Click on upload message - - HTML5 Drag'and'Drop (via dropzone.js) - - No Javascript HTML Form fallback + - Choose files via dialigue + - Drop files, via HTML5 drag'and'drop (using [dropzone.js](http://www.dropzonejs.com/)) + - Basic HTML Form (if no JavaScript is suported) - Upload using any compatible tool (like cURL) This example will upload a file and copy URL to clipboard: - + ```bash - curl -F "file=@$(pwd)/file.jpg" http://your-host/sharing/ > xclip -sel clip + curl -F "file=@file.jpg" your-host/sharing/ | xclip -sel clip ``` diff --git a/index.php b/index.php index 57a4407..f96dc81 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,25 @@ '.', + + + // Display list uploaded files + listfiles => true, + + + // Display debugging information + debug => false + + ); + + // ============== Configuration end ============== // Relative path to this file (don't edit) $settings['scriptpath'] = $_SERVER['PHP_SELF']; @@ -13,6 +27,17 @@ // Name of this file (don't edit) $settings['scriptname'] = pathinfo(__FILE__, PATHINFO_FILENAME) . '.php'; + // URL to upload page + $settings['pageurl'] = $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['REQUEST_URI']), '\\/'); + + // Displaying debug information + if ($settings['debug']) { + echo '

Debugging information

'; + echo '
';
+		print_r($settings);
+		echo '
'; + } + if (isset($_FILES['file']) && strlen($_FILES['file']['name']) > 1) { $upload_file_name = basename($_FILES['file']['name']); $uploadpath = $settings['uploaddir'] . DIRECTORY_SEPARATOR . $upload_file_name;