我想将视频文件从本地目录上传到DropBox。我创建了一个实例。另外我的视频文件不超过3 MB。
@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'
答案 0 :(得分:0)
以下是我的代码的答案......我们不需要将其保存在目录中。我们可以直接使用本地视频路径。这里是更新的代码:
[self.restClient uploadFile:@"upload.mov" toPath:@"/" withParentRev:nil fromPath:[self.videoURL path]];