I am trying to have a PHP form that takes in a maximum of three images from the user and puts them in a specified directory in my htdocs directory (using Apache).
PHP Documentation: [url]http://us.php.net/manual/en/features…ad.post-method
It had a script to something very similar to what I am trying to do. However, this is my code:
[code=php]
<form action=”fileupload.php” method=”post” enctype=”multipart/form-data”>
<p>Pictures:<br>
<input type=”file” name=”pictures[]” /><br>
<input type=”file” name=”pictures[]” /><br>
<input type=”file” name=”pictures[]” /><br>
<input type=”submit” name=”submit” value=”Send” />
</p>
</form>
<?php
if ($_POST[“submit”]) {
echo “SUBMITTED<br>”;
foreach ($_FILES[“pictures”][“error”] as $key => $error) {
echo “go throught the files<br>”;
if ($error == UPLOAD_ERR_OK) {
echo “ERROR: ” . $error . “<br>”;
$tmp_name = $_FILES[“pictures”][“tmp_name”][$key];
echo “tmp_name: ” . $tmp_name . “<br>”;
$name = $_FILES[“pictures”][“name”][$key];
echo “name: ” . $name . “<br>”;
move_uploaded_file($tmp_name, “data/$name”);
}
}
}
?>
and this is my php.ini file where I changed the upload_path accordingly:
[code]
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = “C:Program FilesApache Software FoundationApache2.2htdocsminiimagesgallery”
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
When i write out $tmp_name is comes out as:
tmp_name: C:DOCUME~1CRAIGR~1LOCALS~1Tempphpuploadphp7 4.tmp
What is going wrong here?
Cheers,
Picco
?