首頁  >  問答  >  主體

java - 七牛 上传提交总是报Wire::wire: << "{"error":"scope not specified"}"

说明:plistFile是一段xml文本,转换成InputStream; bucketName;accessKey,secretKey是从属性文件获取
Properties proper = new Properties();
proper.load(in);
String bucketName = proper.getProperty("bucketName");
String accessKey = proper.getProperty("accessKey");
String secretKey = proper.getProperty("secretKey");
String https = proper.getProperty("plistHttps");
System.out.println("accessKey========="+accessKey);
System.out.println("https========="+https);

        Mac mac = new Mac(accessKey, secretKey);
        // 请确保该bucket已经存在
        PutPolicy putPolicy = new PutPolicy(bucketName);
        String uptoken = putPolicy.token(mac);
        PutExtra extra = new PutExtra();
        String key = "";
        InputStream is = new ByteArrayInputStream(plistFile.getBytes());
        extra.mimeType = "application/xml";

        PutRet ret = IoApi.Put(uptoken, "xx.xml", is, extra);
伊谢尔伦伊谢尔伦2724 天前957

全部回覆(1)我來回復

  • 高洛峰

    高洛峰2017-04-17 14:41:25

    你可以列印 bucketName的值 是否正確傳入的是你空間裡面的bucketName,最好可以提供一下uploadtoken,來確認一下你上傳策略的scope欄位的問題。

    回覆
    0
  • 取消回覆