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>"; */ } } ?> Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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 ) ! Quote Link to comment 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 Quote Link to comment 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!" Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.