0

While uploading photos only images(with specific images types)have to be shown in dialogue box not other file types Please someone provide the code

sKhan
  • 9,694
  • 16
  • 55
  • 53
  • Welcome to Stack Overflow. Please take a look at [how to ask good questions](http://stackoverflow.com/help/how-to-ask). Take time to craft a good title - duplicating your title as content is lazy and wont get you much help here. You also need to show what code you have tried so far and give an example of what types you are trying to mask. Include just enough code to allow others to reproduce the problem. – micstr Feb 20 '16 at 08:05

2 Answers2

0

use accept attribute of input tag:

<input type="file" name="myImage" accept="image/*" />

Although it's better to checking this at server side. Because data which are came from client side is not reliable. Clients can send any type of data. They can even change .exe file to .jpg

inverted_index
  • 2,329
  • 21
  • 40
0

Or this link here:

Limit file format when using <input type="file">?

filters file types. But you have to check the file-type in php anyway, because the user can normally changethe filter.

Anyway on uploading files you should check the uploaded files like here:

http://webcheatsheet.com/php/file_upload.php

or

What is the most secure method for uploading a file?

or google a little:"secure file upload php"

Community
  • 1
  • 1
Kilian Hertel
  • 166
  • 1
  • 14