同一时间上传的图片,有些还能显示,有些不见了访问出现404。
七牛内容管理也找不到图片。
丢失图片链接: http://lukou-pic.qiniudn.com/1451275132407.jpg
public void addPic(@RequestParam("file")MultipartFile file,PrintWriter pw)
{
String bucket = configCache.getValue("upload_bucket_pic");
Auth auth = Auth.create(configCache.getValue("upload_access_key"), configCache.getValue("upload_secret_key"));
String token =auth.uploadToken(bucket);
try {
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
UploadManager uploadManager = new UploadManager();
Response res = uploadManager.put(file.getBytes(),new Date().getTime()+suffix, token,null,file.getContentType(),false);
System.out.println(JSON.parseObject(res.bodyString()).get("hash"));
String url = "http://" + bucket + ".qiniudn.com/"+JSON.parseObject(res.bodyString()).get("key");
JsonUtil.outSuccess(pw,url);
} catch (QiniuException e) {
e.printStackTrace();
System.out.println("七牛上传出错");
JsonUtil.outError(pw);
} catch (IOException e) {
e.printStackTrace();
System.out.println("文件上传出错");
JsonUtil.outError(pw);
}
}
这个问题你可以咨询一下七牛