Hello,
I have a problem.
I am unable to send a file using the 'file' input field of an html form <input name="thefile" type="file"> .
Error received:
Parse error: parse error, unexpected '<' in /home/.sites/137/site468/web/receiver.php3 on line 27
n.b.
I believe I have all the correct permissions set up to write/recieve the data to a php page ( i.e. the chmod settings ) as I was previosuly getting 405 errors and so moved the file that receives the form to a different directory.
form page - test1.php
..................................
<form method="post" action="page.php" enctype="multipart/form-data">
<input name="thefile" type="file"><input type="submit" value="Upload File">
</form>
relevent code on page.php
..........................................
<?php include 'receiver.php3'; ?>
page that receives form - receiver.php3
...............................................................
<?
$uploadPath = "/pstore/".$file_name;
copy ($thefile, $uploadPath);
echo "Your file has been uploaded. Details of the file is listed below:";
echo "$Date";
echo "$Title";
?>
As you can see from the receiver.php3 page there is no line 27, so where has the parse error come from?
I cannot even see that adding the details of the file sent in the form would add enough lines for there to be a line 27.
As you can tell I'm a newbie to php, but I have been stuggling for days - literally - with this.
Please help me!
Cheers
form upload curious error
Moderator: General Moderators
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Hi. Welcome to PHPDN.
Could you please post the code of page.php so we can have a better idea of your problem? Also please enclose all your php code inside
Could you please post the code of page.php so we can have a better idea of your problem? Also please enclose all your php code inside
Code: Select all
[ /PHP] to make your posted code easier to read.
Thanks,
Scorphus.Here is the current relevant php script - I updated it so that the page was located in the correct directory - this had no effect - the same problem remains - infact whatever change I have made returns the same error on line 27..... ( the rest of the page is just standard dhtml - no php )
[/b]
Code: Select all
[/b]
<?php include '/pstore/receiver.php3'; ?>
[b]- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
Maybe it is because of your php.ini options. Check your php.ini on the Language Options section and see if short_open_tag is set to On (short_open_tag = On).
Also read the Configuration directives section of the PHP Manual.
Regards,
Scorphus.
Also read the Configuration directives section of the PHP Manual.
Regards,
Scorphus.
I found this a difficult one to grasp......
I have instead gone for an ultra simple news update system until my PHP knowledge increases.
( I now however think I know what my glaringly obvious problem with this was all along - I was overcomplicating things! My files were both in the same directory and so I did not need to specify a directory prior to the filename - this at lease fixed my problem with the news update system. )
Cheers for all your help - it was appreciated.
I have instead gone for an ultra simple news update system until my PHP knowledge increases.
( I now however think I know what my glaringly obvious problem with this was all along - I was overcomplicating things! My files were both in the same directory and so I did not need to specify a directory prior to the filename - this at lease fixed my problem with the news update system. )
Cheers for all your help - it was appreciated.