i got an error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Apache2\htdocs\xunknowntears\admin\img_upload.php on line 21

with this code for uploading images:

<?php
if ( isset ( $_FILES['fupload'] ) ) 
{
	print "name: ".			$_FILES['fupload']['name']				."<br>";
	print "size: ".			$_FILES['fupload']['size']				."<br>";
	print "temp name: ".	$_FILES['fupload']['tmp_name']			."<br>";
	print "type: ".			$_FILES['fupload']['type']				."<br>";
	print "error: ".		$_FILES['fupload']['error']				."<br>";

if ( $_FILES['fupload']['type'] == "image/gif' ) 
{
	$source = $_FILES['fupload']['tmp_name'];
	$target = "../pictures/".$_FILES['fupload']['name'];
	move_uploaded_file( $source, $target ); // or die ("Couldn't Copy");
	$size = getImageSize( $target );
	$imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" src=\"$target\" alt=\"Uploaded Image\" ></p>";

	print $imgstr;
}
}
?>

I looked it over for about 2 hours and only found small typo's that were causing previous errors, but i cant find the one that causes this one. all mt tmp dirs are at the defauls in the php.ini file. i even looked it over some more in my PHP book. but still no result, any ideas?

Longbow

    if ( $_FILES['fupload']['type'] == "image/gif' )

    should be :

    if ( $_FILES['fupload']['type'] == "image/gif[color=red]"[/color] )

      hmmmmmmmmm it was 350am... i do have something of an excuse... :o :o
      well it works now 😃 thanks
      i have another question
      what would be the function to resize JPEG images form their original size,
      then i want to have it save them to a diff DIR

        [man]imagecopyresized/man <-- Resize image
        [man]imagejpeg/man <-- Save/output image to file

        ~Brett

          As an alternative to [man]imagecopyresized/man, [man]imagecopyresampled/man is supposed to give you better quality, though I still think it's lacking as far as that goes.

            Write a Reply...