【问题标题】:jQuery ajax like file upload with iframejQuery ajax 喜欢使用 iframe 上传文件
【发布时间】:2012-02-22 15:14:07
【问题描述】:

http://mypokerpartner.com/

测试在上面的链接中。

$('a').click(function(){
    $('input[type="file"]').click();
});
$('input[type="file"]').on('change', function(){
    $('form').submit();
});

使用表单的浏览按钮时,文件会在更改时提交。当使用“A”的链接时,IE 会抛出 SCRIPT5: Access is denied. 的错误

I want for the anchor link to invoke the file dialog and when a file is selected it auto submits the file to the iframe for a non-reloading file upload

编辑: 看起来只是 IE9 中的问题

提前致谢

【问题讨论】:

  • 在 IE7-8 中它按预期工作。您遇到问题的浏览器版本到底是什么? jsfiddle.net/qk3Ur

标签: javascript jquery ajax iframe file-upload


【解决方案1】:

由于某种我不知道的原因,虽然input 字段有任何name attribute,但 IE 会抛出错误。删除文件 input fieldname attribute 修复了此问题。

【讨论】:

    猜你喜欢
    • 2010-10-17
    • 2016-04-04
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 2012-07-24
    • 2013-08-28
    相关资源
    最近更新 更多