mechedd Posted October 16, 2009 Share Posted October 16, 2009 Ok, I just started experimenting with PHP today. My goal right now is to have people be able to upload files to my website, but I am starting at square one. I can make a .php print out the name of the file by calling it with $_POST. When I try to access the $_FILES array it does not work. I want to print out the file name and type using $_FILES["file"]["name"] and $_FILES["file"]["type"] by using echo, but it just shows up blank. What is happening? -mechedd Link to comment https://forums.phpfreaks.com/topic/177860-solved-_files-array/ Share on other sites More sharing options...
ialsoagree Posted October 16, 2009 Share Posted October 16, 2009 You have a form element set up the following way? <input name="file" type="file" /> Also try... echo $_FILES['file']['error']; Need to see some code to provide much more help then that. Link to comment https://forums.phpfreaks.com/topic/177860-solved-_files-array/#findComment-937816 Share on other sites More sharing options...
mechedd Posted October 16, 2009 Author Share Posted October 16, 2009 I got it to work! I just had to add enctype="multipart/form-data" to the <form> tag. Thanks for your help! -mechedd Link to comment https://forums.phpfreaks.com/topic/177860-solved-_files-array/#findComment-937822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.