note 40231 deleted from features.file-upload by irchtml
| From: | irchtml@php.net | Date: | Thu, 26 Feb 2004 07:01:10 +0000 |
| Subject: | note 40231 deleted from features.file-upload by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65776@lists.php.net to get a copy of this message | ||
Note Submitter: Maxik
----
Please help me... I got a upload.
here you can see "upload.php".:
<?php
// Set the upload place, after your document root directory
$upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/upload/";
if (isset($_POST[submit])) {
// Write as many file upload
// inputs as user wanted
$file_amount = $_POST['file_amount'];
$counter = 1;
while ($counter <= $file_amount) {
$foto_input .= "$counter. file: <input name='filename[$counter]'
type='file'><br />\n";
$counter++;
}
// Generate an html output
// where to display the file
// upload fields
print "<form enctype='multipart/form-data' action='$PHP_SELF'
method='post' name='upload_form'>
<table width='100%' border='0' align='center'>
<tr><td>
<li>Upload path: $upload_dir</li>\n
<li>Amount of files to upload:
<b>$file_amount</b></li>\n
</td></tr>\n
<tr><td>$foto_input</td></tr>\n
<tr><td><input type='submit' name='upload'
value='Upload Files'></td></tr>\n
</table>\n
</form>\n";
} else {
// Generate the form
// for user to select how many uploads he
// wants to do.
print "<form name='gallery_setup' method='post'
action='$PHP_SELF'>" .
"Number of photos to upload:" .
" <input name='file_amount' type='text'
id='file_amount' size='10'>" .
" <input type='hidden' name='MAX_FILE_SIZE'
value='300000000'>" .
" <input name='submit' type='submit'
id='submit' value='submit'> " .
"</form>";
}
if (isset($_POST[upload])) {
// Get the upload file array
// and upload them to a destination
// by looping through that array
// Get the variables from previous form
$up_files = $_FILES['filename'];
$counter = 0;
// Start the file upload to server
while($counter <= count($up_files)) {
if($up_files['size'][$counter] > 0) {
$filetype = $up_files['type'][$counter];
$filename = $up_files['name'][$counter];
$tempname = $up_files['tmp_name'][$counter];
$upload_file = $upload_dir . $filename;
// Upload the files
move_uploaded_file($tempname, $upload_file);
// Print the uploaded file
print "File <b>$filename</b> uploaded... new location:
<b>$upload_file</b><br />";
}
$counter++;
}
// End if upload
}
?>
but i can make it to show the image files. Please how to i make it to i can se in a *.php the
images? and how to i make the small? Thanx