JS 上传 (631:no such bucket) 。不懂哪里指定空间路径错误?

QiniuStorage.prototype._put = function (key, blob, update) {
/ *console 结果如下
key: 5da58aa0-6a83-bc6d-e223-f0e0fe76dcf8
this._bucket: 7xn*.z0.glb.clouddn.com
blob的内容应是 {"title":"I don't have ID éà&\n"}

  • /

    var data,
      put_policy,
      encoded,
      encode_signed,
      upload_token;
    data = new FormData();
    if (update === true) {
      put_policy = JSON.stringify({
        "scope": this._bucket + ':' + key,
        "deadline": DEADLINE
      });
    } else {
      put_policy = JSON.stringify({
        "scope": this._bucket,
        "deadline": DEADLINE
      });
    }
    encoded = btoa(put_policy);
    encode_signed = b64_hmac_sha1(this._secret_key, encoded);
    upload_token = this._access_key + ":" + encode_signed + ":" + encoded;
    data.append("key", key);
    data.append("token", upload_token);
    data.append(
      "file",
      blob,
        key
    );
    
    return jIO.util.ajax({
      "type": "POST",
      "url": http://up.qiniu.com/,
      "data": data
    });

    };

阅读 6.7k
1 个回答

这个是你空间的名字填错了,this._bucket应该是空间的名字,而不是空间的域名。仅仅是空间的名称而已。

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