开发者

What is the complete list of valid file extensions for images?

And the images I'm referring to are the ones that can be embeddable in a web开发者_Python百科 browser not .tif, .psd, etc.

So the only ones I'm aware of are .png / .jpg / .jpeg / .gif / .bmp

are there any more?

Reason why I need this info is to only allow valid images to be uploaded in my php file upload script.


you can do what ever you like, its all about the headers, and the information inside the actual image that determines the type. (mime-types)

hence why <img href='http://site.com/image.php?name=file'> could actually render an image


Maybe not a direct answer to this question, but since you mentioned that the purpose of this is to restrict a file upload, the HTML5 answer to this problem would be to use:

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

In addition to that you may also want a server-side check.

In terms of all possible valid image types, there isn't really a simple answer, but most of the information you would need to construct one would be to consult with this list on wikipedia. It of course depends a bit on what the image is going to be used for. The set of images that can be rendered by a browser is going to be different from the set that can be opened in photoshop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜