2017-08-24 34 views
0

的Safari 9.1.2访问控制检查中的Safari S3直接上传

试图通过使用节点AWS-SDK签名的请求PDF文件上传到S3时,我有一个问题。这种情况会间歇性地发生,谷歌搜索会说这是一个CORS问题,但它在90%的时间内运行良好!拉我的听到了!

我没有注意到Firefox这个问题发生,如果文件超过500Kb。我修正了这个问题,但我仍然在Safari上遇到这个问题。

客户

// https://gist.github.com/guumaster/9f18204aca2bd6c71a24 
    $.ajax({ 
     type: 'PUT', 
     url: signedRequest, 
     // Content type must much with the parameter you signed your URL with 
     contentType: file.type, 
     // this flag is important, if not set, it will try to send data as a form 
     processData: false, 
     // the actual file is sent raw 
     data: file, 
     success: function (data, textStatus, request) { 
      addToSupportingDocsURLDO(annexureFilename, reference, url, callback); 
     }, 
     error: function (err, textStatus, request) { 
      _errorCallback('Could not upload file: ' + file.name + ' Please decrease the size of your file or try again later.'); 
      // TODO: send [email protected] email with error 
     } 
    }); 

错误

的XMLHttpRequest不能加载https://sofassets.s3-ap-southeast-2.amazonaws.com/597725898b90e600118f9c9d/599eb7843301240011281ecb/Annexure-D.pdf?AWSAccessKeyId=ACCESSKEYID&Content-Type=application%2Fpdf&Expires=1503574043&Signature=SIGNATURE&x-amz-acl=public-read由于访问控制检查。

回答

0

如果你没有排序了这一点还是这里的人的土地和我一样,我们有同样的问题,我仍然不能相信这是问题,但...改变我们的按钮从<button type="submit"<button type="button"解决了它。显然苹果决定提交按钮不应该提交数据...