techrahul87 Posted July 8, 2011 Share Posted July 8, 2011 hello i am uploading a file in a folder. the code is working fine on localhost. but oon server it is generating error. Parse error: syntax error, unexpected '}' in /home/content/v/i/b/vibescom/html/temp_dir/upload.php on line 1 here is the code <html> <head></head> <body> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } else { ?> <form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <?php } ?> </body> </html> please help me out Quote Link to comment https://forums.phpfreaks.com/topic/241403-parse-error/ Share on other sites More sharing options...
gristoi Posted July 8, 2011 Share Posted July 8, 2011 this works fine on my localhost. Is this upload.php that you have posted? Quote Link to comment https://forums.phpfreaks.com/topic/241403-parse-error/#findComment-1240036 Share on other sites More sharing options...
techrahul87 Posted July 8, 2011 Author Share Posted July 8, 2011 yes it is upload.php..try it on server......i was getting error......... Quote Link to comment https://forums.phpfreaks.com/topic/241403-parse-error/#findComment-1240052 Share on other sites More sharing options...
gristoi Posted July 8, 2011 Share Posted July 8, 2011 my localhost is a full apache linux server Quote Link to comment https://forums.phpfreaks.com/topic/241403-parse-error/#findComment-1240053 Share on other sites More sharing options...
techrahul87 Posted July 8, 2011 Author Share Posted July 8, 2011 Quote Link to comment https://forums.phpfreaks.com/topic/241403-parse-error/#findComment-1240056 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.