0
有些人可以幫助理解發生了什麼問題?上傳.db文件到服務器..磁盤映像格式錯誤?
我將使用multipart/formdata請求將我的.db文件上傳到服務器。 我使用ASIFormdataRequest來形成請求,我得到的答覆作爲success.But當我嘗試下載文件時,我得到磁盤映像格式不正確。 我粘貼代碼
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSString* path = [self FilePath];
NSData *dataBaseData = [NSData alloc];
dataBaseData = [NSData dataWithContentsOfFile:path];
NSLog(@"databaselength %d",dataBaseData.length);
NSString* authHeader = [self returnAuthHeader];
NSLog(@"Auth Header %@", authHeader);
[request addRequestHeader:@"Accept" value:@"application/xml"];
[request addRequestHeader:@"Authorization" value:authHeader];
[request addRequestHeader:@"Content-Type" value:@"multipart/form-data"];
// [request setFile:dataBaseData withFileName:@"sample.db" andContentType:@"multipart/form-data" forKey:@"filedata"];
[request addData:dataBaseData withFileName:@"sample.db" andContentType:@"application/octet-stream" forKey:@"filedata"];
[request setPostFormat:ASIMultipartFormDataPostFormat];
[request setDelegate:self];
NSLog(@"Request %@",request);
[request updateUploadProgress];
[request startAsynchronous];
畸形如何?完全損壞?之前/之後添加的文本?字節改變了? –