Commit 232e81d1 by 王栋源

wdy

parent ff0bf57b
......@@ -16,7 +16,7 @@ import java.util.Map;
public class Test {
// 上传文件
private String localFilePath = "/tmp/20191125_2.json";
private String localFilePath = "";
// Endpoint以杭州为例,其它Region请按实际情况填写。
private String endpoint = "https://partner-sync-file.oss-cn-beijing.aliyuncs.com";
// 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
......@@ -24,7 +24,7 @@ public class Test {
// 存储空间名称
private String bucketName = "partner-sync-file";
// 文件名称
private String objectName = "1956270874932536/20191126_2.json";
private String objectName = "";
private String encodePolicy = "eyJleHBpcmF0aW9uIjoiMjAxOS0xMS0yNlQwNDowMzo0Mi43ODdaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsNTI0Mjg4MDAwXSxbInN0YXJ0cy13aXRoIiwiJGtleSIsIjE5NTYyNzA4NzQ5MzI1MzYiXSxbImVxIiwiJGJ1Y2tldCIsInBhcnRuZXItc3luYy1maWxlIl1dfQ==";
......@@ -32,7 +32,8 @@ public class Test {
public void doUpload(String objectName,String encodePolicy,String signature) throws Exception {
this.objectName="1956270874932536/"+objectName;
this.objectName="1525276744866147/"+objectName;
this.localFilePath="/tmp/"+objectName;
// 在URL中添加存储空间名称,添加后URL如下:http://yourBucketName.oss-cn-hangzhou.aliyuncs.com
String urlStr = endpoint.replace("http://", "http://" + bucketName + ".");
// 表单Map。
......
-------------------------------------------------------------------------------
Test set: com.example.demo.DemoApplicationTests
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.433 s - in com.example.demo.DemoApplicationTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.298 s - in com.example.demo.DemoApplicationTests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment