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? Link to comment https://forums.phpfreaks.com/topic/138527-solved-_files-array-returning-empty/ 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 Link to comment https://forums.phpfreaks.com/topic/138527-solved-_files-array-returning-empty/#findComment-724302 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 Link to comment https://forums.phpfreaks.com/topic/138527-solved-_files-array-returning-empty/#findComment-724306 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 Link to comment https://forums.phpfreaks.com/topic/138527-solved-_files-array-returning-empty/#findComment-724309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.