hi there...
i have the following codes (HTML and PHP) on my Apache Localhost:
HTML: titled "Form.html"
PHP: titled "uploader.p hp"
i've also created a folder called "uploads" in the same directory as the .html and .php files.
the problem i'm having is that i always get the message:
"There was an error uploading the file, please try again!"
i don't know what i'm doing wrong... this is the most basic php upload script... does Apache not allow files to be written to the localhost folders? am i suppose to change anything in my php.ini file? the file i attempted to upload is really small, and well below the php.ini's max file/memory size limits...
anyone?
i have the following codes (HTML and PHP) on my Apache Localhost:
HTML: titled "Form.html"
Code:
<form enctype="multipart/form-data" action="uploader.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>
Code:
<?php
$target_path = "uploads/";
$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!";
}
?>
the problem i'm having is that i always get the message:
"There was an error uploading the file, please try again!"
i don't know what i'm doing wrong... this is the most basic php upload script... does Apache not allow files to be written to the localhost folders? am i suppose to change anything in my php.ini file? the file i attempted to upload is really small, and well below the php.ini's max file/memory size limits...
anyone?
Comment