【问题标题】:Is it possible to upload files to S3 from browser in IE8?是否可以在 IE8 中从浏览器将文件上传到 S3?
【发布时间】:2014-10-21 01:43:25
【问题描述】:

现在我在 javascript 中有这段代码。

var file_object = $('#PHOTO').get(0).files[0];

the_form = new FormData(); 
the_form.append("AWSAccessKeyId", "TESTING");
the_form.append("acl", "authenticated-read");
the_form.append("policy", policy);
the_form.append("signature", signature);
the_form.append("Content-Type", "image/jpeg");
the_form.append("key", "test.jpg");
the_form.append("file", file_object);

$.ajax({
    url: "http://S3BUCKET.s3.amazonaws.com",
    type: "POST",
    data: the_form,
    processData: false,
    contentType: false
})

除了 IE6、7、8、9 之外,它在 Chrome、Firefox 中运行良好。

原因是直到IE10才支持文件对象!

https://developer.mozilla.org/en-US/docs/Web/API/File

IE10之前的浏览器有没有变通的解决方案?

PS:代码示例会很好!

【问题讨论】:

    标签: file upload amazon-s3 internet-explorer-9 internet-explorer-10


    【解决方案1】:

    如果没有 Flash,很多事情肯定是不行的。我相信您引用的库有一些 Flash 后备,但我不清楚它们是否可以处理所有涉及的问题。这是我目前正在处理的事情,以下是简要的问题:

    • 响应中的内容类型标头。 IE(没有 Flash 中介)将尝试下载 JSON 内容类型,我知道如果没有代理中间人来伪造标题,我就无法解决这个问题。
    • 主机名映射。如果您不映射到原始主机名,IE iframe(这是非 Flash 后备)将不允许您从包含窗口读取它的内容。一劳永逸可能是可能的,但消耗来自 s3 的响应/检测错误可能不会。

    随着我在未来几天发现更多信息,我会更新这个答案。这是一个大型项目,所以我们有一些非常重要的要求,我想我会在接下来的一周左右学到很多东西。

    这里有更详细的介绍(不是我的公司/项目/帖子):http://blog.fineuploader.com/2013/08/16/fine-uploader-s3-upload-directly-to-amazon-s3-from-your-browser/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-10
      • 2018-04-28
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 2015-11-11
      • 1970-01-01
      相关资源
      最近更新 更多