diff --git a/MY_Upload.php b/MY_Upload.php index a18400f..da6e278 100644 --- a/MY_Upload.php +++ b/MY_Upload.php @@ -1,12 +1,36 @@ ' . $count ); - - for($i = 0; $i < $count; $i++) + + foreach ( $_FILES[$field]['name'] as $i => $value ) { // Was the file able to be uploaded? If not, determine the reason why. @@ -84,6 +108,16 @@ public function do_multi_upload( $field = 'userfile', $return_info = TRUE ){ return FALSE; } + // Lowercase extension + if ( $lowercase_ext == TRUE ) { + $this->file_ext = strtolower($this->file_ext); + } + + // Rename destination filename + if ( !empty($new_file_name) ) { + $this->file_name = str_replace('{i}',$i,$new_file_name) . $this->file_ext; + } + // if we're overriding, let's now make sure the new name and type is allowed if ($this->_file_name_override != '') { @@ -131,7 +165,7 @@ public function do_multi_upload( $field = 'userfile', $return_info = TRUE ){ // Sanitize the file name for security $this->file_name = $this->clean_file_name($this->file_name); - + // Truncate the file name if it's too long if ($this->max_filename > 0) { @@ -234,5 +268,3 @@ public function do_multi_upload( $field = 'userfile', $return_info = TRUE ){ } } - -?> \ No newline at end of file