Plugin Directory

Changeset 3190096


Ignore:
Timestamp:
11/16/2024 09:40:37 AM (17 months ago)
Author:
wibergsweb
Message:

Removal uploading files manually

Location:
csv-to-html/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • csv-to-html/trunk/csvtohtml.php

    r3190079 r3190096  
    44Plugin URI: http://www.wibergsweb.se/plugins/csvtohtml
    55Description:Display/edit/synchronize csv-file(s) dynamically into a html-table
    6 Version: 3.06
     6Version: 3.07
    77Author: Wibergs Web
    88Author URI: http://www.wibergsweb.se/
     
    5959        $this->init();
    6060    }     
    61 
    62    
    63    /**
    64     *   uploadfile_ajax()
    65     *   
    66     *   Used when uploading a file. Used for csv or json-files.
    67     *
    68     *  @param   N/A
    69     *  @return  N/A
    70     *
    71     */
    72     public function uploadfile_ajax()
    73     {
    74         if (!empty($_FILES['csv_file']))
    75         {
    76             $file = $_FILES['csv_file'];
    77    
    78             if ($file['error'] === UPLOAD_ERR_OK)
    79             {
    80                 $file_name = $file['name'];
    81                 $temp_file = $file['tmp_name'];
    82    
    83                 //Move uploaded file to Wordpress upload folder
    84                 $upload_dir = wp_upload_dir();
    85 
    86                 //This copies files into plugin examples folder
    87                 //These files will not be there after an updatet of the plugin
    88                 if ( $_POST['frm_path'] == '%temp%' )
    89                 {
    90                     $upload_dir['basedir'] =  WP_PLUGIN_DIR . '/csv-to-html/examples';
    91                     $upload_dir['baseurl'] = 'file uploaded into plugin examples folder';
    92                 }
    93 
    94                 $destination = $upload_dir['basedir'] . '/' . $file_name;               
    95                 if (move_uploaded_file($temp_file, $destination))
    96                 {
    97                     $file_url = $upload_dir['baseurl'] . '/' . $file_name;   
    98                     echo json_encode( __('File uploaded successfully', 'csv-to-html') . ': ' . $file_url);
    99                 }
    100                 else
    101                 {
    102                     echo json_encode( __('Error moving uploaded file.', 'csv-to-html') );
    103                 }
    104             }
    105             else
    106             {
    107                 echo json_encode( __('Error uploading file: ', 'csv-to-html') );
    108             }
    109         }
    110         else
    111         {
    112             echo json_encode( __('No file selected.', 'csv-to-html') );
    113         }
    114 
    115         wp_die();
    116     }
    11761
    11862
     
    699643        <strong>Get started!</strong><br>       
    700644        * <strong>Select source file(s).</strong>
    701         Local file\'s root are in wp-content/uploads: <strong>Do this by clicking on General section down below and modify path and file(s).</strong><br>
    702         * If you don\'t have access to the uploads-folder, then upload your file to the upload folder here:
    703         <input type="hidden" name="action" value="upload_file">
    704         <input type="file" name="csv_file" accept=".csv,.json,.xlsx">
    705         <input type="submit" value="Upload file">
    706         <div id="upload-result"><b>Note! <span style="color:red;">If you\'re using Wordpress Playground</span> (Live Preview from plugin page), then <span style="color:red;">set %temp% in path</span> and delimiter to semicolon (;) to view an example csv-file and do a lot of testing with different settings. <span style="color:red;">Uploading files in the Playground environment does not work at the moment</span>.<br><br>When using IMPORT-functionality ALL files with the same name will be overwritten!</div>
    707  
     645        Local file\'s root are in wp-content/uploads: <strong>Do this by clicking on General section down below and modify path and file(s).</strong>
     646        </p>
    708647        <p style="font-size:1.3em;padding:0.5em;margin:0;color:darkgreen;">     
    709648        * Click on different sections down below and <strong>make changes of settings and then click on Update/Preview</strong> button<br>
  • csv-to-html/trunk/readme.txt

    r3190079 r3190096  
    141141== Changelog ==
    142142
     143= 3.07 =
     144Removal of uploading files manually (usage with Playground-functionality). Removal also because of security issues with uploading.
     145
    143146= 3.06 =
    144147Stable tag folder/content added to follow Wordpress new policies regarding structure of svn. (2024-11-16)
Note: See TracChangeset for help on using the changeset viewer.