本文介绍了如何检查图像文件是否存在与扩展名无关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! i编写代码以检查图像是否存在于文件夹中而不使用单个扩展名,但我需要检查所有图像扩展我如何修改脚本 即我想检查是否,jpg,.jpeg,.png,.gif扩展名 var path =../mapimages/+ name +。png; $。 ajax({ url:path, 类型:'HEAD', 错误:function(){ 提醒(不存在); }, 成功:function(){ alert(文件在这里做点什么); } }); 解决方案 Hi,i written the code to check whether the image exist in a folder or not without using single extension,but i need to check the all images extensions how i can modify the scripti.e i want to check if for ,jpg,.jpeg,.png,.gif extension var path = "../mapimages/" + name + ".png"; $.ajax({ url: path, type: 'HEAD', error: function () { alert("does not exist"); }, success: function () { alert("file exists do something here"); } }); 解决方案 这篇关于如何检查图像文件是否存在与扩展名无关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 11:54
查看更多