Chrome浏览器不能连续上传相同的图片,第二次无请求,页面采用jquery.form.js插件异步提交?

html:
<form id="uploadForm">
    <input id="img" class="hidden" type="file" name="file" />
</form>
脚本:
$('#uploadForm').ajaxSubmit({
    url: '……',
    type: 'post',
    async: true,
    cache: false,
    dataType: 'json',
    contentType: 'multipart/form-data',
    beforeSend: function(){//发送前
                
    },
    complete: function(){//发送后
                
    },
    success: function(data){//请求成功
                 
    },
    error: function(response, textStatus, errorThrown){//请求失败
                 
    }
});
阅读 3.3k
1 个回答

你需要在完成时,重置表单,在请求成功之后 加入
$('input[type=file]').wrap('<form>').closest('form').get(0).reset();

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题