]> git.mxchange.org Git - simple-upload.git/commitdiff
Added debug information display
authormuchweb <aleks@s-ko.net>
Tue, 23 Sep 2014 12:41:32 +0000 (13:41 +0100)
committermuchweb <aleks@s-ko.net>
Tue, 23 Sep 2014 12:41:32 +0000 (13:41 +0100)
README.md
index.php

index 98099c329aada88247dd8b394fbc3516c1db2ead..06717bef88bda2ac979871e9c640b9be5c30cec7 100644 (file)
--- 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
        ```
index 57a4407935a27d03e1810a2aab8afecbeeb9c7cd..f96dc81b797ce8a6c78c7a879a57dc47bfd61e8b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,11 +1,25 @@
 <?php
-       $settings = array();
 
-       // Directory to store the uploaded files
-       $settings['uploaddir'] = '.';
 
-       // List uploaded files
-       $settings['listfiles'] = true;
+       // ============== Configuration begin  ==============
+
+       $settings = array(
+
+
+               // Directory to store uploaded files
+               uploaddir => '.',
+
+
+               // 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'];
        // 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 '<h1>Debugging information</h1>';
+               echo '<pre>';
+               print_r($settings);
+               echo '</pre>';
+       }
+
        if (isset($_FILES['file']) && strlen($_FILES['file']['name']) > 1) {
                $upload_file_name = basename($_FILES['file']['name']);
                $uploadpath = $settings['uploaddir'] . DIRECTORY_SEPARATOR . $upload_file_name;