scarhand Posted November 18, 2007 Share Posted November 18, 2007 im working on a simple image upload script (my first try) well i noticed that for some reason its not even recognizing a file being uploaded...ive tried using the phpfreaks simple image upload tutorial but that wont seem to work for me. so heres what ive got and this wont even work: <?php if (isset($_POST['submit'])) { if (!empty($_FILES['myphoto']['tmp_name'])) { echo "file has been selected"; } } ?> <form method="post"> <input name="myphoto" type="file" class="normalinput"> <br> <input name="submit" type="submit" value="Submit Registration"> </form> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 18, 2007 Share Posted November 18, 2007 You're missing a couple or parts from your form. You need to specify an enctype of '"multipart/form-data", and you also need so specify a maximum file size in your form(not sure how far you'll get with your testing before this actually becomes a necessity, but it will at some point). Try: <form method="post" enctype="multipart/form-data"> <input name="MAX_FILE_SIZE" type="hidden" value = "1000000" /> <input name="myphoto" type="file" class="normalinput"> <br> <input name="submit" type="submit" value="Submit Registration"> </form> Quote Link to comment Share on other sites More sharing options...
scarhand Posted November 18, 2007 Author Share Posted November 18, 2007 thank you 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.