i found appropriate script lets me upload multiple image files server. trying change name of files , have no idea how using code. please tell me need do? thanks
<?php /* * * @ multiple file upload script. * * @ can number of file uploads * @ set variables below , away go * * @ author: kevin waterson * * @copywrite 2008 phpro.org * */ error_reporting(e_all); /*** upload directory ***/ $upload_dir= './uploads'; /*** numver of files upload ***/ $num_uploads = 1; /*** maximum filesize allowed in bytes ***/ $max_file_size = 99951200; /*** maximum filesize php.ini ***/ $ini_max = str_replace('m', '', ini_get('upload_max_filesize')); $upload_max = $ini_max * 9991024; /*** message users ***/ $msg = 'please select files uploading'; /*** array hold messages ***/ $messages = array(); /*** check if file has been submitted ***/ if(isset($_files['userfile']['tmp_name'])) { /** loop through array of files ***/ for($i=0; $i < count($_files['userfile']['tmp_name']);$i++) { // check if there file in array if(!is_uploaded_file($_files['userfile']['tmp_name'][$i])) { $messages[] = 'no file uploaded'; } /*** check if file less max php.ini size ***/ elseif($_files['userfile']['size'][$i] > $upload_max) { $messages[] = "file size exceeds $upload_max php.ini limit"; } // check file less maximum file size elseif($_files['userfile']['size'][$i] > $max_file_size) { $messages[] = "file size exceeds $max_file_size limit"; } else { // copy file specified dir if(@copy($_files['userfile']['tmp_name'][$i],$upload_dir.'/'.$_files['userfile']['name'][$i])) { /*** give praise , php gods ***/ $messages[] = $_files['userfile']['name'][$i].' uploaded'; } else { /*** error message ***/ $messages[] = 'uploading '.$_files['userfile']['name'][$i].' failed'; } } } } ?>
try change
if(@copy($_files['userfile']['tmp_name'][$i],$upload_dir.'/'.$_files['userfile']['name'][$i]))
for
if(@copy($_files['userfile']['tmp_name'][$i],$upload_dir.'/'.'name of file']))
Comments
Post a Comment