My PHP code for file upload is not working.?
I have been given some PHP code and some html to upload images to my website from my host. It does not seem to be working. Here it is:
<?php
//places files into same dir as form resides
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
move_uploaded_file(
$_FILES["pictures"]["tmp_name"][$key],
$_FILES["pictures"]["name"][$key]
) or die("Problems with upload");
}
}
echo "Your files, were uploaded succesfully";
echo "
";
echo "<a href='uploadform.php'>go back</a>";
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<p>Pictures:
<input type="file" name="pictures[]" />
<input type="submit" value="Send" />
</p>
</form>
Does the file the form is in need to be .PHP also?
I have been given some PHP code and some html to upload images to my website from my host. It does not seem to be working. Here it is:
<?php
//places files into same dir as form resides
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
move_uploaded_file(
$_FILES["pictures"]["tmp_name"][$key],
$_FILES["pictures"]["name"][$key]
) or die("Problems with upload");
}
}
echo "Your files, were uploaded succesfully";
echo "
";
echo "<a href='uploadform.php'>go back</a>";
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<p>Pictures:
<input type="file" name="pictures[]" />
<input type="submit" value="Send" />
</p>
</form>
Does the file the form is in need to be .PHP also?