java
String bucket = QiNiuConfig.BUCKETNAME; String key = "http://7xic7y.com2.z0.glb.qiniucdn.com/uploads/20150413/2015041313382847008.mp4"; String notifyURL = ""; boolean force = true; String pipeline = ""; StringMap params = new StringMap().putNotEmpty("notifyURL", notifyURL) .putWhen("force", 1, force).putNotEmpty("pipeline", pipeline); // CHECKSTYLE:OFF String fops = "vframe/jpg/offset/1/w/480/h/360"; // CHECKSTYLE:ON try { String id = operater.pfop(bucket, key, fops, params); String purl = "http://api.qiniu.com/status/get/prefop?id=" + id; System.out.println(purl); } catch (QiniuException e) { Response res = e.response; System.out.println(res); try { System.out.println(res.bodyString()); } catch (QiniuException e1) { e1.printStackTrace(); } }
控制台报错:
{ResponseInfo:com.qiniu.http.Response@376fa42f,status:612, reqId:l3sAAO_8MFihxNQT, xlog:rs12_9.sel/not found;rs11_9.sel/not found;rdb.g/no such key;DBD/404;DBG/404;v4.sel:1/Document not found;qtbl.get:2/Document not found;RS:2/612;PFOP:5/612;APIS:6/612, xvia:, adress:api.qiniu.com/183.136.139.28:80, duration:0.000000 s, error:no such file or directory}
{"error":"no such file or directory"}
难道是我的文件名有问题吗? 但是我把文件名放到地址栏可以访问到的啊!!求解答,谢谢
你这里的问题很明显
key是文件名,而不是文件外链, key 这个变量赋值为 uploads/20150413/2015041313382847008.mp4
而不是http://7xic7y.com2.z0.glb.qiniucdn.com/uploads/20150413/20150413133828...
改一下就可以了