Forum Moderators: coopster
Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\easyftp\sendfiles.php on line 24
line 24 is $savefile = 'C:\maxdata\FTPAdmin\SendFilesHere\UploadForm\'.trim($HTTP_POST_FILES['userfile']['name']);
I am going back and forth a lot on this. The previous lines have all have semi-colons and the basics of PHP seem to be there.
Here is the complete form handler
<?php
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
{
//$filename0 = $HTTP_POST_FILES['userfile']['tmp_name'];
//echo "<br>$filename0 was uploaded successfuly";
echo $HTTP_POST_FILES['userfile']['tmp_name']." is temp name<BR>";
echo $HTTP_POST_FILES['userfile']['name']." is real name<BR>";
$realname = trim($HTTP_POST_FILES['userfile']['name']);
//echo "<br>realname is $realname0 for order";
//echo "<br>copying file to uploads dir";
$upfile = $HTTP_POST_FILES['userfile']['tmp_name'];
$savefile = 'C:\maxdata\FTPAdmin\SendFilesHere\UploadForm\'.trim($HTTP_POST_FILES['userfile']['name']);
IF (!copy($upfile,$savefile))
{
echo trim('Error Receiving File '.$savefile);
}
ELSE
{
echo trim('Successfully received file');
}
}
?>
results in--
Parse error: parse error, unexpected $ in c:\inetpub\wwwroot\easyftp\sendfiles.php on line 40
Line 40 is the end of file
I think the quote is getting escaped out by the slash, how do I have it just be a slash.
I tried single quotes and got this error
Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\easyftp\sendfiles.php on line 30
Line 30 is the error copying file
What is T_STRING
// in all windows paths instead of / and " on each side make it work on my windows system.
Now i just have to simplify out all the debugging type stuff and enable multiple file uploads...
Thanks for the help
<?php
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
{
echo $HTTP_POST_FILES['userfile']['tmp_name']." is temp name<BR>";
echo $HTTP_POST_FILES['userfile']['name']." is real name<BR>";
$realname = trim($HTTP_POST_FILES['userfile']['name']);
$upfile = trim($HTTP_POST_FILES['userfile']['tmp_name']);
$file=$HTTP_POST_FILES['userfile']['name'];
$savefile = "C:\\maxdata\\FTPAdmin\\SendFilesHere\\UploadForm\\".trim($file);
echo $savefile;
IF (!copy($upfile,$savefile))
{
echo 'Error Receiving File';
}
ELSE
{
echo trim('Successfully received file');
}
}
?>