I am somewhat a newbie to PHP. I am trying to create a file upload. It seems to upload to the tmp directory, but fails to move when using move_upload_file(). When checking the $_FILES array after uploading, it shows that everything should be good, including 0 errors. Not sure what I’m doing wrong. HELP!
Here is my code:
<?php
if (isset($_POST[‘submit’])) {
if (isset($
$imageName = $_FILES[‘imageUpload’][‘name’];
echo $imageName;
echo “<br />”;
if (move_uploaded_file($
chmod(“uploaded/” . $_FILES[‘imageUpload’][‘name’], 0644);
echo “File “” . $imageName . “” successfully uploaded. <br />n”;
}
else {
echo “There was an error uploading “” . htmlentities($
print_r($_FILES);
}
}
}
?>
<form action=”inc_UploadImage.php” method=”post” enctype =”multipart/form-data”>
Select an image to upload:
<input type=”hidden” name=”MAX_FILE_SIZE” value=”5000000″ />
<input type=”file” name=”imageUpload”><br />
<input type=”submit” value=”Upload Image” name=”submit” />
<input type=”reset” value=”Reset Field” name=”reset” />
</form>