// ******************************* // ******************************* // ******************************* // UPLOADING OF FILES STARTS HERE // ******************************* // ******************************* if (isset($_POST['localfile']) || isset($_FILES['usrfl'])) { $display_output .= EASYPOPULATE_DISPLAY_HEADING; // ******************************* // ******************************* // UPLOAD AND INSERT FILE // ******************************* // ******************************* if (isset($_FILES['usrfl'])) { // move the uploaded file to where we can work with it $file = ep_get_uploaded_file('usrfl'); // langer - this copies the file to our temp dir. This is required so it can be read into file array. // user not protected from uploading and overwriting a duplicate named file, too bad // $new_file_prefix = 'uploaded-'.strftime('%y%m%d-%H%I%S').'-'; if (is_uploaded_file($file['tmp_name'])) { ep_copy_uploaded_file($file, DIR_FS_CATALOG . $tempdir); } $display_output .= sprintf(EASYPOPULATE_DISPLAY_UPLOADED_FILE_SPEC, $file['tmp_name'], $file['name'], $file['size']); } if (isset($_POST['localfile'])) { // file is already in temp directory... $file['name'] = $_POST['localfile']; $display_output .= sprintf(EASYPOPULATE_DISPLAY_LOCAL_FILE_SPEC, $file['name']); } $file_location = DIR_FS_CATALOG . $tempdir . $file['name']; //TODO: detect shop id
// langer - this copies the file to our temp dir. This is required so it can be read into file array. // add option to change name so it does not over-write any downloads there in same hour? // maybe just add option for seconds to all filenames - problem solved. // our uploads don't have any time stamp, but users can manage this.. //$new_file_prefix = 'uploaded-'.strftime('%y%m%d-%H%I%S').'-'; if (is_uploaded_file($file['tmp_name'])) { ep_copy_uploaded_file($file, DIR_FS_CATALOG . $tempdir); } $display_output .= sprintf(EASYPOPULATE_DISPLAY_UPLOADED_FILE_SPEC, $file['tmp_name'], $file['name'], $file['size']); // get the entire file into an array $readed = file(DIR_FS_CATALOG . $tempdir . $file['name']); } if (isset($_POST['localfile']) && $_GET['split'] != 2) { // dont think $_GET['split']!=2) is rwd, but hey... // move the file to where we can work with it $file = ep_get_uploaded_file('localfile'); //$file['size'] = filesize(DIR_FS_CATALOG . $tempdir . $filename); // langer - what is this attribute stuff doing here?!?!!? It appears to be redundant.. Test attributed upload from localfile /* $attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id"; $attribute_options_values = ep_query($attribute_options_query); $attribute_options_count = 1; */ //while ($attribute_options = mysql_fetch_array($attribute_options_values)) $display_output .= sprintf(EASYPOPULATE_DISPLAY_LOCAL_FILE_SPEC, $file['name']); // get the entire file into an array $readed = file(DIR_FS_CATALOG . $tempdir . $file['name']); } // split = 2 means we are using ep to create page for uploading each split file in turn if ($_GET['split'] == 2) { $printsplit = EASYPOPULATE_FILE_SPLITS_HEADING;