<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
</Error>
当我尝试下载该文件时,它显示未找到blob,我不知道问题出在哪里,请你指出来,我已经给出了下面的下载日志.... 提前谢谢
这是我的图片上传代码
public void upload()
{
try{
File file = new File(""+Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)+"/aa.jpg");
FileMetaData metadata = new FileMetaData("myFile");
// metadata.setAcl((new KinveyMetaData()).AccessControlList().setGloballyReadable(true)); //create the FileMetaData object
metadata.setPublic(true); //set the file to be pubicly accesible
// metadata.setAcl((new KinveyMetaData.AccessControlList()).setGloballyReadable(true)); //allow all users to see this file
metadata.setFileName("abc.jpg");
FileInputStream fin=new FileInputStream(file);
UploaderProgressListener upl=new UploaderProgressListener() {
@Override
public void onSuccess(Void result) {
System.out.println("upload success!");
}
@Override
public void onFailure(Throwable error) {
System.out.println("upload progress change!");
}
@Override
public void progressChanged(MediaHttpUploader uploader) throws IOException {
System.out.println("upload progress change -> " + uploader.getUploadState());
}
};
mKinveyClient.file().upload(metadata,fin,upl);
}catch(Exception e){
System.out.println("Couldn't upload! -> " + e);
e.printStackTrace();
}
}
这是我下载代码的图片
public void download() {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/aa11.jpg");
try {
FileOutputStream fos = new FileOutputStream(file);
DownloaderProgressListener dpl=new DownloaderProgressListener() {
@Override
public void progressChanged(MediaHttpDownloader mediaHttpDownloader) throws IOException {
System.out.println("progress updated: "+mediaHttpDownloader.getDownloadState());
}
@Override
public void onSuccess(Void aVoid) {
System.out.println("successfully download file");
}
@Override
public void onFailure(Throwable throwable) {
// System.out.println("failed to download file :->"+throwable.getCause());
System.out.println("failed to download file :->"+throwable.getLocalizedMessage());
System.out.println("failed to download file :->"+throwable.getStackTrace());
}
};
Query myQuery=new Query();
myQuery.equals("id","myFile");
client.file().download(myQuery,fos,dpl);
}catch(Exception e)
{
System.out.println("in catch block,could'nt download file ---->"+e.getMessage());
}
}
登录下载图片代码....,下载我发现“blob not found”请查看日志....
16:09:46.036 13008-13008 / com.kinvey.sample.statusshare I / System.out: 要在aa1.jpg下载新文件 11-02 16:09:46.051 13008-13341 / com.kinvey.sample.statusshare I / System.out:进度已更新:DOWNLOAD_IN_PROGRESS 11-02 16:09:46.051 13008-13341 / com.kinvey.sample.statusshare I / System.out:进度更新:INITIATION_STARTED 11-02 16:09:46.870 13008-13341 / com.kinvey.sample.statusshare I / System.out:无法下载文件: - &gt; 11-02 16:09:46.870 13008-13341 / com.kinvey.sample.statusshare I / System.out:REASON:BlobNotFound 11-02 16:09:46.870 13008-13341 / com.kinvey.sample.statusshare I / System.out:FIX:找不到此app后端的blob 11-02 16:09:46.870 13008-13341 / com.kinvey.sample.statusshare I / System.out:说明: 正在下载的文件不存在。 11-02 16:09:46.890 13008-13341 / com.kinvey.sample.statusshare I / System.out:未能 下载文件: - &gt; [Ljava.lang.StackTraceElement; @ 33e9dd19
答案 0 :(得分:0)
加布里埃尔,
谢谢, Pranav Kinvey支持