bravo14 Posted March 1, 2012 Share Posted March 1, 2012 Hi guys I am getting an error of Notice: Undefined index: photo_filename in /home/sites/haldonguesthouse.co.uk/public_html/new-site/admin/upload.php on line 28 I understand that the error would suggest that the field is not referenced on the form that is used to post the values through. Below is the form code that is used to post the values <form id="add_gallery" action="upload.php" method="post"> <table> <tr> <td>Gallery Name</td> <td><select name="category" id="category"> <option>Please select...</option> <option value="14">Superior Double Room</option><option value="15">Superior Single Room</option><option value="16">Double en-suite</option><option value="17">Twin or Triple Room, en suite</option><option value="18">Family Room for 4</option><option value="19">Single Room with Private Facilities</option><option value="20">Double Room with Private Facilities</option><option value="21">The Gallery</option></select></td> </tr> <tr> <td> Photo 1: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 2: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 3: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 4: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 5: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 6: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 7: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 8: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 9: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td> Photo 10: <input name='photo_filename[]' type='file' /> </td> </tr> <tr> <td> Title: <input name='photo_caption[]' type="text" size="30"> </td> </tr><tr> <td></td><td><input type="submit" name="submit" value="Upload Photos"/></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/258045-undefined-index/ Share on other sites More sharing options...
requinix Posted March 1, 2012 Share Posted March 1, 2012 I bet you're looking for it in $_POST, right? That's not where uploaded files go. Look in $_FILES instead. Quote Link to comment https://forums.phpfreaks.com/topic/258045-undefined-index/#findComment-1322732 Share on other sites More sharing options...
bravo14 Posted March 1, 2012 Author Share Posted March 1, 2012 Hi Have checked that and the offending line (28) is below $photos_uploaded = $_FILES['photo_filename']; Quote Link to comment https://forums.phpfreaks.com/topic/258045-undefined-index/#findComment-1322733 Share on other sites More sharing options...
PFMaBiSmAd Posted March 1, 2012 Share Posted March 1, 2012 Your <form ....> tag is missing the enctype attribute that is needed for uploads to work. Ref: http://us3.php.net/manual/en/features.file-upload.post-method.php Quote Link to comment https://forums.phpfreaks.com/topic/258045-undefined-index/#findComment-1322734 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.