The given PHP example helps you to upload the multiple files on server at once.
<?php
for ( $i =0; $i < $file_to_upload ; $i ++) { |
if (trim( $_FILES [ 'myfiles' ][ 'name' ][ $i ])!= "" ) { |
$newfile = $file_dir . $_FILES [ 'myfiles' ][ 'name' ][ $i ]; |
move_uploaded_file( $_FILES [ 'myfiles' ][ 'tmp_name' ][ $i ], $newfile ); |
if (isset( $j )&& $j >0) print "Your file(s) has been uploaded.<br>" ; |
print "<form method='post' enctype='multipart/form-data'>" ; |
for ( $i =0; $i < $file_to_upload ; $i ++) { |
print "<input type='file' name='myfiles[]' size='30'><br>" ; |
print "<input type='submit' name='action' value='Upload'>" ; |
?>
No comments:
Post a Comment