DJDarkViper Posted December 27, 2008 Share Posted December 27, 2008 Excuse me whilst i rip my hair out over this dilemma its a very simple form: <form action="addproduct.php" method="POST"> <table align="center"> <tr> <td>Name</td><td><input type="text" name="prod_name" /></td> </tr> <tr> <td>Photo</td><td><input type="file" name="prod_file" /></td> </tr> <tr> <td>Info</td><td><input type="text" name="prod_info" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="Add Product" style="width: 100%" /></td> </tr> </table> </form> this is whats on addproduct.php: <? echo "Prod File: " . $_FILES['prod_file'] . "<br />Prod file name: " . $_FILES['prod_file']['name'] . "<br />Prod File tmp_name: " . $_FILES['prod_file']['tmp_name']; ?> and all i get back is this when attempting to upload C:\guitar.jpg: Prod File: Prod file name: Prod File tmp_name: Simple stuff im really just trying to figure out why my uploading code wasn't working, just to do this out of pure frustration only to find that overall, the $_FILES array isn't returning anything at all. Also, Yes i did check phpinfo, it is using PHP Version 5.2.5, file_uploads are On and On, and on top of everything else, im about ready to lose my mind! anyone have any input? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 27, 2008 Share Posted December 27, 2008 In order for a form to be used for uploads, you must use enctype="multipart/form-data" in your form tag: <form enctype="multipart/form-data" action="addproduct.php" method="POST"> Ken Quote Link to comment Share on other sites More sharing options...
DJDarkViper Posted December 27, 2008 Author Share Posted December 27, 2008 In order for a form to be used for uploads, you must use enctype="multipart/form-data" in your form tag: <form enctype="multipart/form-data" action="addproduct.php" method="POST"> Ken awesome, that worked. Strangely enough that little tidbit wasn't in ANY documentation i found, not even on php.net. thanks for the speedy reply, i knew itd be something tiny Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 27, 2008 Share Posted December 27, 2008 It's mentioned on this page in the manual. Ken 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.