您必须在http://yourowncloudserver.com/owncloud/remote.php/webdav/与 WebDav 界面进行通信
要上传文件,您必须对文件的命运发出 PUT 请求,例如:http:
//yourowncloudserver.com/owncloud/remote.php/webdav/file.zip
并将输入流添加到读取文件的请求中。
这是 CURL 命令:
curl -X PUT -u username:password "http://yourserver.com/owncloud/remote.php/webdav/file.zip" -F myfile=@"/Users/Javi/Downloads/file.zip"
您还可以检查我们在 Objective C 上的代码以检查我们使用的参数:
ownCloud iOS 库
NSMutableURLRequest *request = [self requestWithMethod:@"PUT" path:remoteDestination parameters:nil];
[request setTimeoutInterval:k_timeout_upload];
[request setValue:[NSString stringWithFormat:@"%lld", [UtilsFramework getSizeInBytesByPath:localSource]] forHTTPHeaderField:@"Content-Length"];
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
//[request setHTTPBody:[NSData dataWithContentsOfFile:localSource]];
__weak __block OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request success:success failure:failure];
[operation setInputStream:[NSInputStream inputStreamWithFileAtPath:localSource]];