I'm sending a file from a form and for some reason it fails consistently when I add one trailing backslash.
$_FILES['file']['name']=$HTTP_POST_VARS['form'];
$uploaddir="C:\Apache\htdocs\generic\pdf";
if (move_uploaded_file($FILES['file']['tmp_name'],$uploaddir.$FILES['file']['name'].".pdf")) {
print "File is valid, and was successfully uploaded.";
} else {
echo ("\n<script language='Javascript'>".
"<!--\n".
"alert(\"ERROR: File Not Saved!.\");".
"//-->\n".
"</script>\n");
}
If I change the $uploaddir to have a trailing slash it fails everytime saying:
"Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\apache\htdocs\bellevue\drivers\forms\formsubmit.php on line 7
"
However if I don't change it, the file saved ends up being called pdf(filename).pdf and is put one level below the directory it needs to be in.
Any ideas as to ewhat is causing that error?