fluteflute Posted June 2, 2007 Share Posted June 2, 2007 I was playing with my upload script when I got the error: faultCode0faultStringParse error:syntax error, unexpected '{' in /path/htdocs/upload.php on line 59 And I can't see where that unexpected '{' is! <?php if(!isset($_POST['Upload'])) { echo "No File Selected<p>"; echo "<form action='upload.php' method='POST' enctype='multipart/form-data'> <input type='hidden' name='MAX_FILE_SIZE' value='300000' /> <input type='file' name='pix' /><br /> <input type='submit' value='Add Stamps' name='Upload'></form>"; } else { $filename = $_FILES['pix']['name']; $ext = strrchr($filename, "."); if($_FILES['pix']['tmp_name'] == "none") { echo "<b>File did not successfully upload. Check the file size. File must be less than 500K.<br>"; exit(); } if($ext !== (".gif") { echo "<b>File is not a .gif. Please try another file.</b><br>"; exit(); } else { echo "Would have uploaded"; /* $destination = "images/".$_FILES['pix']['name']; $temp_file = $_FILES['pix']['tmp_name']; move_uploaded_file($temp_file,$destination); echo "<p><b>The file has successfully uploaded:</b> {$_FILES['pix']['name']} ({$_FILES['pix']['size']})</p>"; */ } } ?> Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/ Share on other sites More sharing options...
chocopi Posted June 2, 2007 Share Posted June 2, 2007 On this bit you need to close a ) if($ext !== (".gif") { change to if($ext !== (".gif")) { Hope it helps, ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266913 Share on other sites More sharing options...
taith Posted June 2, 2007 Share Posted June 2, 2007 if($ext !== (".gif") { you have an extra ( in there... drat! chocopi beat me to it! lol Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266915 Share on other sites More sharing options...
fluteflute Posted June 2, 2007 Author Share Posted June 2, 2007 Thanks people! Seems odd that a unexpected { message actually requires me to add a ) ! Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266916 Share on other sites More sharing options...
chocopi Posted June 2, 2007 Share Posted June 2, 2007 Yea i know what you mean, it would be so much more helpful if actually said that the problem was with a normal bracket and not a curly one. oh welly, its good its all sorted now Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266918 Share on other sites More sharing options...
taith Posted June 2, 2007 Share Posted June 2, 2007 it means that it expected another )... but hit a { first... and said... "HEY! thats not supposed to be there!" Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266919 Share on other sites More sharing options...
chocopi Posted June 2, 2007 Share Posted June 2, 2007 fairplay, i guess i would prefer it if it told exactly what the error was, but i doubt thats quite possible Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266931 Share on other sites More sharing options...
taith Posted June 2, 2007 Share Posted June 2, 2007 ya.... i wish... lol just use a program like notepad++ which autocolours your text... makes debuging a breeze! Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266942 Share on other sites More sharing options...
chocopi Posted June 2, 2007 Share Posted June 2, 2007 yea ive been thinking about getting it for some time now as i just use the normal notepad for all my coding Link to comment https://forums.phpfreaks.com/topic/53995-solved-upload-script-suddenly-produces-error/#findComment-266946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.