Back to Non-Emulation Help

PHP upload script

yoshi2889OP
#1
I'm a n00b to PHP and this is my first try so...I want to create a PHP upload script, using this tutorial.I've got two files: upload.html and uploader.php.
Now, I've tried to upload a file of 100 KB to my server.
It only gives the error message "There was an error uploading the file, please try again".Page: http://yoshi2889creations.vacau.com/upload.html
and http://yoshi2889creations.vacau.com/uploader.phpHost: 000webhost (http://www.000webhost.com/)upload.html:
<html><head><title>Yoshi2889's Creations: Submit Project</title></head><body>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500" />
Choose a file to upload: <input name="uploadedfile" type="file" />

<input type="submit" value="Upload File" />
</form>
uploader.php:
<?php
$target_path = "NEW/";
$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.";
}
?>
Anyone know how to fix this or know a better script?
Loonylion
#2
your host may not allow php file uploads.
yoshi2889OP
#3

Replying to #2

Could also be a problem...although I have uploaded a few files with SMF and they work fine.Directory is CHModded to 777, FYI.
Showing posts 1–3 of 3 · This discussion is archivedBack to top