Hi everyone.
I've got a problem I've been working on all day with no success.
I have a code snippet that allows users of my site to upload a small file. It's shown here:
if($_FILES[img1] != "") {
copy($_FILES[img1][tmp_name], "/home2/username/public_html/directory/subdir/" .$_FILES[img1][name]) or mysql_error();
} else {
die("No input file specified.");
}
Now... if I create a simple PHP page with nothing but a simple form, and a PHP page with the above code as the target of the form, the file gets uploaded fine.
However... if I try to do ANYTHING else... specifically, insert either / both the form or code snippet above as an include to a PHP file... the file upload fails every time with a "No input file specified" error.
This wouldn't normally be such a big deal... except that in this particular case I have to have the form for the file upload appear ONLY if certain conditions are met... which requires me to place the form and the code snippet into include files.
Am I attempting to do something with the $_FILES function that is not possible?
Any ideas would be greatly appreciated.