AnsweredAssumed Answered

Upload file / folder through webscript

Question asked by lakshya on Jan 27, 2009
Latest reply on Feb 6, 2009 by kocoubb
I am able to create folder / document through REStful APIs.
But now facing the problem to upload the file from disk to repository.

For creating document I have written the following code :
URL = "http://localhost:8081/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children";
PostMethod method = new PostMethod(URL);
String contentType = "application/atom+xml;type=entry";
File upload = new File("testDoc.xml");
method.setRequestHeader("name", upload.getName());
method.setRequestHeader("Content-type", contentType);
method.setRequestBody(new FileInputStream(upload));

<?xml version='1.0' encoding='utf-8'?>
        <entry xmlns='' xmlns:cmis=''>
         <title>My Picts</title>
         <summary>My Picts – Summary</summary>       
           <cmis:propertyString cmis:name='ObjectTypeId'><cmis:value>document</cmis:value></cmis:propertyString>

How can I post the request to get the file from disk. XML should take the inputStream in this case.
How can I resolve this issue. Any pointer ??