尝试使用RestClinet,Request和响应连接到owncloud服务器的简单程序。虽然List.php工作得很好,但我无法使用upload.php来处理
error {"data":{"message":"Unable to set upload directory."},"status":"error"}
这是我用于两个命令的代码,只是注释掉一个,
//Restclient1.BaseURL := 'https://server.edu/owncloud/index.php/apps/files/ajax/list.php';
Restclient1.BaseURL := 'https://server.edu/owncloud/index.php/apps/files/ajax/upload.php';
RESTResponseDataSetAdapter1.AutoUpdate := false;
upload_stream := TFileStream.Create('c:\users\me\test.txt',fmOpenRead);
upload_stream.Position := 0;
RESTRequest1.Params.AddHeader('Content-Type', 'text/plain');
RESTRequest1.ClearBody;
RESTRequest1.AddBody(upload_stream,TRESTContentType.ctTEXT_PLAIN);
RESTRequest1.Execute;
jValue:=RESTResponse1.JSONValue;
Memo1.Text:= jValue.ToString;
upload.php的代码指出,如果没有指定目录,则使用用户defualt目录。 https://github.com/Insiteo/owncloud-core/blob/master/apps/files/ajax/upload.php
不确定设置目录是否必需或如何设置。
感谢