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 Quote Link to comment 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. Quote Link to comment 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 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.