Question Detail

How can to show only Images while Uploading Images in the Folder?
I have set allow type in php it just filter that you should upload only images types.
How can i do it by HTML?
or any other way except Javascript or Jquery
 Thanks


Thread Reply

Bili Greed

- 1 years ago

HTML5 File input has accepted attribute and also multiple attributes. By using multiple attributes you can upload multiple images in an instance.

<input type="file" multiple accept='image/*'>

You can also limit multiple mime types.

<input type="file" multiple accept='image/*|audio/*|video/*' >

and another way of checking mime type using file object.

file object gives you name, size, and type.

var files=e.target.files;

var mimeType=files[0].type; // You can get the mime type

You can also restrict the user for some file types to upload by the above code.

Bili Greedy

- 1 years ago

HTML5 File input has accepted attribute and also multiple attributes. By using multiple attributes you can upload multiple images in an instance.

<input type="file" multiple accept='image/*'>

You can also limit multiple mime types.

<input type="file" multiple accept='image/*|audio/*|video/*' >

and another way of checking mime type using file object.

file object gives you name, size, and type.

var files=e.target.files;

var mimeType=files[0].type; // You can get the mime type

You can also restrict the user for some file types to upload by the above code.

Brijesh Tanwar

- 1 years ago

May be this will help you. 

<input type="file" multiple accept='aplication/image'>