(java) 七牛报错”error”:”token not specified”

客户端<script type=”text/javascript”>

function upLoaduploadCallback { $.ajax{ type : POST, url : ${basePath}upload, success : functiondataStr, status { uploadCallbackdataStr.token; }, error : functiondata, status, e { } };
} function uploadCallbacktoken { $.ajaxFileUpload{ url : http://up.qiniu.com/, secureuri : false, date : { token : token, key:test }, dataType : json, type : post, success : functiondataStr, status { }, error : functiondata, status, e { } };
}

</script>
</head>
<body>

 <input type="file" name="file" class="file-upload" id="upload" onchange="upLoad uploadCallback ;" />

</body>
服务端
public void doGetHttpServletRequest request, HttpServletResponse response throws ServletException, IOException {

 Gson gson = new Gson; Map<String, Object> r = new HashMap<String, Object>; String token=QiniuConfig.getUpToken; r.put"token", token; String data = gson.toJsonr; response.getWriter.writedata; }
/**
    • 生成Token

    • @return
      */

    1. static String getUpToken {

       return auth .uploadToken QiniuConfig.bucket, null, 3600, new StringMap .putNotEmpty "returnBody", "{"key": $key, "hash": $etag, "width": $imageInfo.width, "height": $imageInfo.height}";

      }

    自己做的demo为什么老是报错token not specified,请大神指导下

    发表评论

    电子邮件地址不会被公开。 必填项已用*标注