kirkh34 Posted October 18, 2010 Share Posted October 18, 2010 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 https://forums.phpfreaks.com/topic/216196-whats-wrong-with-my-upload-script/ Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2010 Share Posted October 18, 2010 get rid of the errant left bracket on line 47. Link to comment https://forums.phpfreaks.com/topic/216196-whats-wrong-with-my-upload-script/#findComment-1123607 Share on other sites More sharing options...
kirkh34 Posted October 18, 2010 Author Share Posted October 18, 2010 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 https://forums.phpfreaks.com/topic/216196-whats-wrong-with-my-upload-script/#findComment-1123621 Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2010 Share Posted October 18, 2010 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 https://forums.phpfreaks.com/topic/216196-whats-wrong-with-my-upload-script/#findComment-1123626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.