Page 1 of 1

PARSE ERROR????

Posted: Tue Aug 10, 2004 12:07 pm
by gladiator2043
I am getting an error:
Parse error: parse error, unexpected $ in /home/carbuys/public_html/upload_car_image.php on line 150



on the following script. I have no clue what is causing it. I have checked everything. can anyone help?

Code: Select all

<?

//user defined variables
$abpath = "seller_images"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
$number_of_uploads = 1;  //Number of uploads to occur

if ($_REQUEST['submitted']){ // Begin processing portion of script

//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type

$log = "";

for ($i=0; $i<$number_of_uploads; $i++) {

	//checks if file exists
	if ($img_name[$i] == "") {
		$log .= "No file selected for upload $i<br>";
	}

	if ($img_name[$i] != "") {
		//checks if file exists
		if (file_exists("$abpath/$img_name[$i]")) {
			$log .= "File $i already existed<br>";
		} else {

			//checks if files to big
			if (($sizelim == "yes") && ($img_size[$i] > $size)) {
				$log .= "File $i was too big<br>";
			} else {


				//Checks if file is an image
				if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2) or ($img_type[$i] == $cert3) or ($img_type[$i] == $cert4) or ($img_type[$i] == $cert5) or ($img_type[$i] == $cert6) or ($img_type[$i] == $cert7) or ($img_type[$i] == $cert8) or ($img_type[$i] == $cert9) or ($img_type[$i] == $cert10) or ($img_type[$i] == $cert11) or ($img_type[$i] == $cert12) or ($img_type[$i] == $cert13) or ($img_type[$i] == $cert14) or ($img_type[$i] == $cert15) or ($img_type[$i] == $cert16) or ($img_type[$i] == $cert17)) {
					@copy($img[$i], "$abpath/$img_name[$i]") or $log .= "Couldn't copy image 1 to server<br>";
					if (file_exists("$abpath/$img_name[$i]")) {
						$log .= "File $i was uploaded<br>";
                    

                //lets rename the file so it can be organized in the folder
                                                     $old_file = "$abpath/$img_name[$i]"; 
                                                            $new_file = "$abpath/scott".$i.".gif"; 

                                                                 rename($old_file,$new_file);
  

					}
					} else {
						$log .= "File $i is not an image<br>";
					}
				}
			}
		}


	}
//lets send the user to some other page


?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>place an ad</title>
</head>

<body>
<p>&nbsp;</p>
<form action="upload_car_Image.php" method="post" enctype="multipart/form-data" name="form1">

  <table width="619" height="206" border="1" align="center">
    <caption align="top">
    Upload Photos for your car 
    </caption>
    <tr>
      <td colspan="2">
  

         <div align="left">Upload this file: 
<? 

for ($j=0; $j<$number_of_uploads; $j++) {

print($j);
?>
<input type=file name=img[] size=30><br>
<?
}
?> 
           </div></td><td>&nbsp;</td>
    </tr>
    <tr>
      <td width="261"><div align="right"></div></td>
     

<td width="283">&nbsp;</td>
<td width="53">&nbsp;</td>
    </tr>
    <tr>
      <td height="53"><div align="right"></div></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><div align="right"></div></td>
      <td>
      <!-- #EndLibraryItem --></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
       <input type="hidden" name="submitted" value="true">
<input type="submit" name="submit" value="Upload"> 
      </div></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;  </p>

</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

Code: Select all

<?php

?>

Posted: Tue Aug 10, 2004 12:43 pm
by hawleyjr
You have 11 } tags and 12 { tags. Start there...