我想检查其有效图像与否。 我的代码有效的图像如下,其工作完善,但是,当它的图像数组,然后它不起作用?我想在更改函数中使用数组名称
$("#file").change(function() {
var val = $(this).val();
switch(val.substring(val.lastIndexOf('.') + 1).toLowerCase()){
case 'gif': case 'jpg': case 'png':
//alert("an image");
break;
default:
$(this).val('');
// error message here
alert("Please Select Valid Image");
break;
}
});
工作完美的一个形象是指其对ID的工作,但现在我想和图像阵列来工作,那么我做什么?它可能与否?
<input id="file" type="file" name="images[]">Enter 8 Images For Batter Product View
<input type="button" id="addmore" value="Add More Image">
中添加更多的图像
它给我的新形象,所以我需要一个数组,所以我想在数组中检查这种变化功能的有效图像或没有? 有可能吗?
感谢file
类型的
看看这里:http://stackoverflow.com/questions/17400191/get-the-files-chosen-using-the-input-type-file-multiple-and-store -them-in-a-a – Alex2php