Box使用ajax上传文件

时间:2014-07-23 10:56:46

标签: javascript ajax box-api box boxapiv2

我尝试使用来自https://gist.github.com/seanrose/5570650的Box.com API上传文件。

我收到以下错误:

  

`XMLHttpRequest无法加载" https://upload.box.com/api/2.0/files/content"。 No' Access-Control-Allow-Origin'标头出现在请求的资源上。 Origin localhost'因此不允许访问。"

我该怎么办?如何使用AJAX将文件上传到Box.com?

1 个答案:

答案 0 :(得分:0)

这是在CORS主题下的Box Developer Docs中记录的。您需要访问Box Application Configuration页面并将逗号分隔的地址/ IP列表添加到CORS Allowed Origins字段。例如:

enter image description here     http://127.0.0.1,http://localhost,http://localhost:3000,http://10.0.1.2,http://0.0.0.0,https://example.com