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> Link to comment https://forums.phpfreaks.com/topic/77843-solved-any-reason-why-this-simple-image-upload-isnt-working/ 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> Link to comment https://forums.phpfreaks.com/topic/77843-solved-any-reason-why-this-simple-image-upload-isnt-working/#findComment-394001 Share on other sites More sharing options...
scarhand Posted November 18, 2007 Author Share Posted November 18, 2007 thank you Link to comment https://forums.phpfreaks.com/topic/77843-solved-any-reason-why-this-simple-image-upload-isnt-working/#findComment-394030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.