obhsmsa Posted September 26, 2013 Share Posted September 26, 2013 <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Thank You For Your Submission, Please Come To Our Next Discssuion To Recieve Your Answer" . $_FILES["file"]["name"] . "<br>"; } $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload" . $_FILES["file"]["name"]; } } <?php i keep getting an error on my closing php "PHP: Parse error: parse error on line 39" Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/ Share on other sites More sharing options...
Solution requinix Posted September 26, 2013 Solution Share Posted September 26, 2013 Got a <?php at the end there that doesn't belong. Please use tags when posting code. Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451245 Share on other sites More sharing options...
obhsmsa Posted September 27, 2013 Author Share Posted September 27, 2013 Even when I do remove it the error changes to error on line 38 Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451343 Share on other sites More sharing options...
requinix Posted September 27, 2013 Share Posted September 27, 2013 When you say "the error" it makes it sound like you're saying you get the exact same error message but on a different line. That is not the case. Unexpected end generally means that you have a { somewhere that isn't closed with a }. Can you find where it is? Does it belong there? Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451344 Share on other sites More sharing options...
obhsmsa Posted September 27, 2013 Author Share Posted September 27, 2013 No I do get the same error just on a different line Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451345 Share on other sites More sharing options...
requinix Posted September 27, 2013 Share Posted September 27, 2013 You're still getting a parse error. Is it still an "unexpected So let's try this over again: 1. What is the exact and entire error message? 2. What is your current code? Don't forget about the tags I mentioned before. Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451351 Share on other sites More sharing options...
obhsmsa Posted September 27, 2013 Author Share Posted September 27, 2013 Sorry im still new to php <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Thank You For Your Submission, Please Come To Our Next Discssuion To Recieve Your Answer" . $_FILES["file"]["name"] . "<br>"; } $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload" . $_FILES["file"]["name"]; } } "PHP: Parse error: parse error on line 38" Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451377 Share on other sites More sharing options...
Ch0cu3r Posted September 27, 2013 Share Posted September 27, 2013 (edited) The curly braces { and } do not match up. This could be what is causing the parse error. The brace is see that doesn't matchup is highlighted bellow: $extension = end($temp); { <--- THIS DOES NOT MATCH UP WITH A } if ($_FILES["file"]["error"] > 0) That could be the issue. A good tip to making sure the braces matches up is to always indent your code example for(someting) { if (condition) { // do something } else { if (condition) { // true } else { // false } } } Notice how each opening { and closing } brace all match up. It makes the code more easier to read and identify an issues like this. Edited September 27, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451379 Share on other sites More sharing options...
obhsmsa Posted September 27, 2013 Author Share Posted September 27, 2013 Thanks It worked Quote Link to comment https://forums.phpfreaks.com/topic/282448-help-php-form-submission/#findComment-1451445 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.