Jump to content

upload form


Chris.P

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/51496-upload-form/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/51496-upload-form/#findComment-253882
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.