开发者社区> 问答> 正文

javasdk怎么上传文件到某个bucket下的某个目录?

java sdk 怎么上传文件到某个bucket下的某个目录?

展开
收起
likejian 2014-04-02 16:16:05 7085 0
3 条回答
写回答
取消 提交回答
  • 回2楼huangjinshe的帖子
    我将key值设置为 /upload/image/aaa.txt
    出现错误  错误代码
    [Error Code]:SignatureDoesNotMatch, [Message]:The request signature we calculated does not match the signature you provided. Check your key and signing method.
        at com.aliyun.openservices.oss.internal.OSSExceptionFactory.create(OSSExceptionFactory.java:15)
        at com.aliyun.openservices.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:39)
        at com.aliyun.common.comm.ServiceClient.handleResponse(ServiceClient.java:284)
        at com.aliyun.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:177)
        at com.aliyun.common.comm.ServiceClient.sendRequest(ServiceClient.java:136)
        at com.aliyun.openservices.oss.internal.OSSOperation.send(OSSOperation.java:60)
        at com.aliyun.openservices.oss.internal.OSSObjectOperation.putObject(OSSObjectOperation.java:76)
        at com.aliyun.openservices.oss.OSSClient.putObject(OSSClient.java:303)
        at com.eeline.util.FileUtil.uploadFile(FileUtil.java:85)
        at com.eeline.util.FileUtil.writeFile(FileUtil.java:34)
        at com.eeline.action.weixin.MatterManagerAction.addMatter(MatterManagerAction.java:117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
        at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
        at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
        at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    2014-04-18 17:40:29
    赞同 展开评论 打赏
  • 直接输入完整路径.  目录的话带"/"头.   如:   KEY=/Folder/aaa.txt

    -------------------------

    回 3楼(hongliu) 的帖子
    提示签名未匹配,看看参数中是否有空格什么的特殊符号
    再更新一下最新SDK试试。
    2014-04-08 00:13:31
    赞同 展开评论 打赏
  • 精通安卓客户端与服务端开发
    Rejavasdk怎么上传文件到某个bucket下的某个目录?
    同求,我也想知道
    2014-04-06 21:21:11
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载