2016-05-11 28 views
0

我想從本地目錄上傳視頻文件到DropBox.I創建了一個實例。同時我的視頻文件不超過3 MB。在目標C中上傳Dropbox上的視頻文件

@property (nonatomic, strong) DBRestClient *restClient; 

,這是我的代碼(轉換爲我本地保存和上傳數據後):

NSData *data = [NSData dataWithContentsOfURL:self.videoURL]; //this is my local video URL path 
NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:@"upload.mov"]; 
[data writeToFile:file atomically:YES]; 
[self.restClient uploadFile:@"upload.mov" toPath:@"Dropbox/Path" withParentRev:nil fromPath:file]; 

我收到這樣的警告:

[WARNING] DropboxSDK: error making request to /1/files_put/sandboxDropbox/Path/upload.mov - (400) Expected 'root' to be 'dropbox', 'sandbox', or 'auto', got u'sandboxDropbox' 
+1

看起來您正在發送帶有附加路徑的文件。您只應以格式/ yourFile發送文件。不要在文件名之前包含路徑。 –

回答

0

下面是答案對於我的代碼...我們不需要將它保存在directory.we可以直接使用本地視頻路徑。這裏更新代碼:

[self.restClient uploadFile:@"upload.mov" toPath:@"/" withParentRev:nil fromPath:[self.videoURL path]];