Hi,
I have a php upload script, but it will only upload text files and not images. Can anyone see why I cannot upload any image files like jpegs or gifs.
I have a php upload script, but it will only upload text files and not images. Can anyone see why I cannot upload any image files like jpegs or gifs.
Code:
<form enctype="multipart/form-data" action="modimagesupload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input class="inputbox" type="file" name="pictures[]" size="79">
<input type="submit">
</form>
Code:
<?php
foreach ($_FILES["pictures"]["error"] as $key => $error) {
echo $_FILES["pictures"]["type"][$key];
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
if(move_uploaded_file($tmp_name, "images/$name"))
{
// we know the move_upload worked, so back it up
copy("images/$name", "backupimages/$name");
}
}
}
print '<pre>';
print_r ($_FILES);
?>