I want to create a file upload form.
But my confusion is that when I add a file element to html, it allows me to select all file types.
I want the browse button to allow images to be selected from the file system.
In fact, it should only display filesystem images.
Thanks in advance.
Uploadify . , . , . , . .
"" MIME, .
<input type="file" accept="image/gif, image/jpeg" />
JS http://swfupload.org/
, , "accept" . :
$accept = array('jpg','png','gif','bmp'); $extension = substr($_FILES['file']['name'],strrpos($_FILES['file']['name'],'.')+1); if(!in_array($extension,$accept)){ // If the extension is not allowed show an error, else, the file type is valid echo 'Not a valid file extension'; }
Source: https://habr.com/ru/post/1724712/More articles:How to change text property of asp.net text field using javascript - javascriptС# resuable library для обработки текстового файла, такого как таблица базы данных? - c#Incorrect character encoding in dist jar created with NetBeans - javaГотово ли производство NHibernate.Linq 1.0 GA? - c#JTextArea.copy () clipboard is cleared when a program exits - javakeeping an item that is tagged with many categories - bitmask? - mysqlHow to read .epub file - c #Transaction on objects in C # - objectUsing Rails googlecharts gem on HTTPS / SSL - ruby-on-railsHTML5 Style Examples In the Wild? - cssAll Articles