有没有任何jquery插件,将限制一个HTML文件上传只接受图像 [英] Is there any Jquery plugin that will restrict a HTML file uploader only to accept images

查看:180
本文介绍了有没有任何jquery插件,将限制一个HTML文件上传只接受图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



意思是,我正在使用我自己的代码。但我没有找到一种方法来限制上传者接受的文件类型..我该怎么做? 。有什么插件只做这个功能(我不想使用一个完整的文件上传插件)

解决方案

HTML5,jQuery是不需要的。我认为它会足够小​​,以使用纯JavaScript:





这些只是一些想法。你可以设计一些启发式来检查文件类型。


I saw a lot of file up loader plugins .I dont want to use the entire file upload plugin ..

Means , I am using my own code. But i didnt find a way to restrict the file type the uploader accepts .. How can i do that? . Is there any plugin which doing only this function ( I don't want to use a full file uploader plugin)

解决方案

This requires HTML5, jQuery is not needed. I think it will be small enough to use pure JavaScript:

These are just some ideas. You can devise some heuristic to check the file type based on this.

这篇关于有没有任何jquery插件,将限制一个HTML文件上传只接受图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆