Hi there -
I got the following quick-and-simple file upload code from a book. I typed it up, uploaded to my server, and it worked great. That was a month ago. Now that I NEED the script to work - it won't. I didn't change a thing, my web hosting service is the same, my PHP config file shows that file uploading is "on" and the limit is 2-megs. I've tried several other scripts since this little guy stopped working and NONE work. I've also tried using move_uploaded_file() rather than copy(), still no go. Is there anything else that I should be looking at?
What happens: I pull up the file, get the file upload screen, browse to find my file, click submit, and get nothing. No file upload, no error message, no success message. The file upload form just replaces itself.
Here's the down and dirty code that used to work:
if ($File) {
print ("File name: $File_name<BR><BR>\n");
print ("File size: $File_size<BR><BR>\n");
if (move_uploaded_file ($File, 'downloads/$File_name')) {
print ("Your file was successfully uploaded!<BR><BR>\n");
} else {
print ("Your file could not be uploaded.\n");
}
unlink ($File);
}
print ("Upload a file to the server:<BR><BR>\n");
print ("<FORM ACTION=\"fileupload.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n");
print ("<input type=hidden name=\"MAX_FILE_SIZE\" value=\"50000\">\n");
print ("File: <INPUT TYPE=FILE NAME=\"File\" SIZE=20><br>\n");
print ("<INPUT TYPE=SUBMIT NAME=\"SUBMIT\" VALUE=\"Submit!\"></form>\n");
Thanks for your help!