Chris.P Posted May 15, 2007 Share Posted May 15, 2007 I have the following upload form that I want to be able to browse images only. Is this possible or something I will have to implement through PHP? <form action="image_upload_action.php" method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> <input name="userfile" type="file" id="userfile"> </td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/51496-upload-form/ Share on other sites More sharing options...
ToonMariner Posted May 15, 2007 Share Posted May 15, 2007 you can 'limit' the file type with the 'accept' attribute of the input eg. <input type="file" name="upfile" id="upfile" accept="gif,png,jpeg,jpg" /> However this is by no means to be trusted - most modern browses ignore it. You could use some javascript to check but that relies on javascript being available... Bottom line is you should ALWAYS check any user input before doing anything with it so I would advise you check this server side. Quote Link to comment https://forums.phpfreaks.com/topic/51496-upload-form/#findComment-253882 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.