Jump to content

What's wrong with my upload script?


kirkh34

Recommended Posts

It says error unexpecting T_ELSE on line 50...Any help is appreciated

 

<?php



if (is_uploaded_file($file_tmp)){

///SUPPORTED IMAGE TYPES

$tgif = "IMAGETYPE_GIF";
$tjpeg = "IMAGETYPE_JPEG";
$tpng = "IMAGETYPE_PNG";
$twsf = "IMAGETYPE_SWF";
$tbmp = "IMAGETYPE_BMP";

$file_size = $_FILES["file"]["size"];
$file_tmp = $_FILES['file']['tmp_name'];
$file_name = $_FILES["file"]["name"] ;
$file_type = $_FILES["file"]["type"];
$file = $file_name . $file_type;


$path = "images/" . $title_id . "/";
$path - $path . basename($file_name);



   if (exif_imagetype('$file') != $tgif || $tjpeg || $tjpng || $twsf || $tbmp){ 


   		  		 if ($file_size < 20000000){     /////20mb/////
   			       					

					if (file_exists($path . $file_name)){


								if (move_uploaded_file($file_tmp,$path)){

								$msg = "File upload successful";	
								}

								else{
								$msg = "There was an error";
								}

					}else{
						$msg = "This file already exists on the server";
						{


			}else{
			 $msg = "File size is too large";
				  }				 

	}else{
		$msg = "File type not supported";
	}	


}else{
$file = "";
}







?>

Link to comment
Share on other sites

thanks duh i should have seen that...been looking at code for too long..... it is work but I am getting another error from my mysql syntax......near 'desc = '', img = '' WHERE id = ''' at line 17

 

mysql_query("UPDATE titles SET title = '$title', desc = '$desc', img = '$file' WHERE id = '$title_id' ")
	 	or die (mysql_error()); 

Link to comment
Share on other sites

desc is a reserved word (DESC, or DESCENDING)

 

I strongly suggest that you change that column name. If you prefer to keep it that way, add back-ticks to the column name in the sql:

 

mysql_query("UPDATE titles SET title = '$title', `desc` = '$desc', img = '$file' WHERE id = '$title_id' ")
	 	or die (mysql_error()); 

 

fyi: i typically use descr or whatever_desc for the column name for description.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.