I have tried this using both $_FILES[] and $HTTP_POST_FILES[] when trying to upload files, but to no avail.
The form I use was fully working, I just wished now, to add a file upload to a previously working form.
form code is:
<input type="file" name="newsfile" size="32" />
<input name="store_dir" type="hidden" value="images/OtherImages/">
if( !is_dir($store_dir) )
{
echo("Specified directory is not valid... Exiting");
unlink($HTTP_POST_FILES['upfile']['tmp_name']);
exit();
}
if( copy($_FILES['newsfile']['tmp_name'], $store_dir.$_FILES['newsfile']['name']) )
{
echo("Uploaded ".$_FILES['newsfile']['name']." successfully.");
}
else
{
echo("Upload of ".$_FILES['newsfile']['name']." to ".$store_dir." failed!!!!<BR>");
}
on my testing server, I get :-
Undefined index: newsfile in c:\inetpub\wwwroot\folder\testfile.php on line 96
it's as if $_FILES['newsfile']['name'] isn't registering.
I have looked for any variable that I need to set in the php.ini file - but have come up with nothing. ANy idea what I have done wrong?
regards