jameshay Posted April 8, 2014 Share Posted April 8, 2014 (edited) I am new to PHP and I am having some problems and I am hoping someone can point me in the right direction. Here is what I need to do: Create a Web Form for uploading pictures for a high school reunion. The form should have text input fields for the person's name and a description of the image, and a file input field for the image. To accompany each file, create a text file that contains the name and description of the image. Create a separate Web Page that displays the pictures with a caption showing the name and description fields. Make sure the folder has read and write for everyone. Here is what I have but it isnt working properly: Process page of the page! an errow here: This is the message I get!Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR) in C:\ITEC315\htdocs\users\ramojumder0\Reinforcement Exercises\Ch. 5\R.E.5-5_FillPictureForm.php on line 28 which deals with the picture! My problem is that it is having a problem uploading a picture and showing it! How do I fix the issue with uploading a picture and then showing it! Input page <form method="POST" action="R.E.5-5_Fillrrr.php"> <p>Name <input type="text" name="name" /></p> <p>Description <input type="text" name="description" /></p> <p>Choose a file to upload: <input type = "file" name = "picture" accept = "image/*" /></p> <p><input type="submit" value="Submit" /></p> </form> <p><a href="R.E.5-5_ShowPictures.php">Show Pictures </a></p> </body> </html> Processing page! <?php if (empty($_POST['name']) || empty($_POST['description'])) echo "<p>You must enter your name and description about your picture. Click your browser's Back button to return to the Picture Input Page!</p>\n"; else { $Name = addslashes($_POST['name']); $Description = addslashes($_POST['description']); $Picture = addslashes($_POST['picture']); $ShowPic = fopen("showpic.txt", "ab"); if (is_writeable("showpic.txt)) { if (fwrite($ShowPic, $Name . "," . $Description . "," . $Picture . "\r\n")) echo "<p>Thank you for filling out the Picture Input Page!</p>\n"; else echo "<p>Cannot add your name to the Picture Input Page!</p>\n"; } else echo "<p>Cannot write to the file.</p>\n"; fclose($ShowPic); } ?><!--End PHP Script--> Edited April 8, 2014 by jameshay Quote Link to comment https://forums.phpfreaks.com/topic/287604-uploading-pictures-to-a-form-in-php/ Share on other sites More sharing options...
QuickOldCar Posted April 8, 2014 Share Posted April 8, 2014 forgot a double quote this line if (is_writeable("showpic.txt")) { Quote Link to comment https://forums.phpfreaks.com/topic/287604-uploading-pictures-to-a-form-in-php/#findComment-1475357 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.