I'm trying to upload a file using php on my local server and after running the script (which is a very simple one) the page that should echo information is just blank. Can someone please help me figure out what the problem is? I've tried reading up on many different posts but I can't seem to find a solution. Thanks
html
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
php
<?php
// Where the file is going to be placed
$target_path = "tmp/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$target_path = "tmp/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
I'm not getting anything from this. Just a blank page...and when I check the tmp DIR nothing is in there... any suggestions? I am using XAMP
EDIT:
Turns out it was two parts. #1 DIR permission, and #2 I had to browse to my xampp directory through the DNS for the server. Which is strange because I could usually just go through localhost and it would work fine. I guess the problem was with XAMPP itself.
Thanks for everyone's help!