PDA

View Full Version : upload image


lemmiwinksx
05-15-2003, 02:46 AM
im trying to make a form - to - image upload script
and i get am error : Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/virtual/site72/fst/var/www/html/testup.php on line 2


heres my code, can anyone please help??? :D :


<?
if(isset(_$Submit_))
{
//If the Submitbutton was pressed do:

if_($_FILES['imagefile']['type']_==_"image/gif"){
copy_($_FILES['imagefile']['tmp_name'],_"images/".$_FILES['imagefile']['name'])_
____or_die_("Could not copy");
echo_"";_
________echo_"Name: ".$_FILES['imagefile']['name']."";_
________echo_"Size: ".$_FILES['imagefile']['size']."";_
________echo_"Type: ".$_FILES['imagefile']['type']."";_
________echo_"Copy Done....";_
________}
else_{
____________echo_"";
____________echo_"Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
________}
}
?>_

Dylan Leblanc
05-15-2003, 06:24 AM
_$Submit_

that does not seem right to me

Ökii
05-15-2003, 11:42 AM
if you copy/pasted the code from another forum/page ('specially on a Mac) you'll just want to search/replace all the dodgy underscores to spaces.

the dodgy ones are all the ones not in $_FILES (oh or the one in tmp_name) - they are actually different ascii characters than the normal btw.

lemmiwinksx
05-15-2003, 03:42 PM
well, theres no underscores when i dont paste it on here :-)

and it still wont work

is it Submit intead of $Submit??

thanks a bunch :D

mordred
05-15-2003, 04:14 PM
It's $Submit without the underlines, I think that's what Dylan hinted at.

lemmiwinksx
05-16-2003, 12:07 AM
i took out all the underscores, but i get --
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/virtual/site72/fst/var/www/html/testup.php on line 2


im asuming that means i need to add a $ somewhere??? :o

thanks :thumbsup:

mordred
05-16-2003, 01:19 AM
Hm. What does your corrected code look like now?

lemmiwinksx
05-16-2003, 06:38 AM
http://pastebin.com/9939

posted there. please help???:eek:

Weirdan
05-16-2003, 08:50 AM
It's here

if(isset( Submit ))


should be:

if(isset($Submit ))


or even:

if(isset($_POST['Submit']))

lemmiwinksx
05-16-2003, 07:33 PM
oh kay, it still won't work... i get this error - Parse error: parse error in /home/virtual/site72/fst/var/www/html/upload.php on line 2


my php code:
<?_
if(isset($_POST['Submit']))
{_
//If the Submitbutton was pressed do:

if_($_FILES['imagefile']['type']_==_"image/gif"){_
copy_($_FILES['imagefile']['tmp_name'],
"images/".$_FILES['imagefile']['name'])
or_die_("Could not copy");_
echo_"";
echo_"Name: ".$_FILES['imagefile']['name']."";
echo_"Size: ".$_FILES['imagefile']['size']."";
echo_"Type: ".$_FILES['imagefile']['type']."";
echo_"Copy Done....";†_
}_
else{_
echo_"";_
echo_"Could Not Copy, Wrong Filetype
(".$_FILES['imagefile']['name'].")";_
}_
}_
?>


please help??? thanks a lot :thumbsup: