[英]input type=“file” .submit() not working IE8
been driving me insane this has. 一直让我发疯。 Works with everything, except... IE8 :( File selection appears (non-images are not filtered out IE8, but that's another issue), but when you select the image the upload script is not fired, nothing gets uploaded.
可以使用所有内容,但是... IE8 :(出现文件选择(非图像不会被IE8过滤掉,但这是另一个问题),但是当您选择图像时,不会触发上传脚本,因此不会上传任何内容。
The $("body").addClass("loading"); $(“ body”)。addClass(“ loading”); is fired (this is the loading modal), so I have no idea when the image-upload.php is not run.
被解雇(这是加载模式),所以我不知道何时不运行image-upload.php。
Thanks folks :) 谢谢大家:)
Javascript: Javascript:
var wrapper = $('<div/>').css({height:0,width:0,'overflow':'hidden'});
var fileInput = $('#file').wrap(wrapper);
$('.chooseFile').click(function(){
fileInput.click();
}).show();
$(document).ready(function() {
fileInput.change(function ()
{
$("body").addClass("loading");
//uploadImg.submit();
$('#uploadImg').submit();
this.blur();
this.focus();
});
});
HTML 的HTML
<form name="uploadImg" id="uploadImg" action="image-upload.php" method="post" enctype="multipart/form-data" class="btnFile">
<div class="chooseFile">Choose File</div>
<input type="file" id="file" name="file" value="Select File to Upload" accept="image/*">
</form>
You need to use 您需要使用
var wrapper = $('<div/>').css({height:0,width:0,'overflow':'hidden'});
var fileInput = $('#file').wrap(wrapper);
$('.chooseFile').click(function(){
fileInput.click();
}).show();
inside 内
$(document).ready(function() {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.