Hi,

this was not about uploading a file, but updating an existing file's content 
from a browser. Mimicking a multipart file upload would probably work, but is 
painful at best with a XHR request.

In the meantime I found out that I can simply POST my updated content directly 
to the jcr:data property:

$ curl -F"./jcr:content/jcr:data=…" http://localhost:8080/path/to/file

Ciao, Victor.

On 06.08.2012, at 14:48, Felix Meschberger wrote:

> Hi,
> 
> Am 06.08.2012 um 14:37 schrieb Bertrand Delacretaz:
> 
>> Hi Victor,
>> 
>> On Mon, Aug 6, 2012 at 1:33 PM, Victor Saar <[email protected]> wrote:
>>> ...I'm working on a simple web-based text editor at the moment and I wonder 
>>> what the easiest way is to POST
>>> file contents back to the server. Does the SlingPostServlet allow this 
>>> (without using a form upload)?...
>> 
>> PUT does create a JCR file structure, I don't think POST does that:
>> 
>> $ date | curl -T - http://admin:admin@localhost:8080/foo.txt
>> 
>> $ curl  http://admin:admin@localhost:8080/foo.txt
>> Mon Aug  6 14:34:44 CEST 2012
>> 
>> $ curl http://admin:admin@localhost:8080/foo.txt.tidy.2.json
>> {
>> "jcr:createdBy": "admin",
>> "jcr:created": "Mon Aug 06 2012 14:33:35 GMT+0200",
>> "jcr:primaryType": "nt:file",
>> "jcr:content": {
>>   "jcr:lastModifiedBy": "admin",
>>   "jcr:uuid": "db850aa7-e4d4-4c37-aae2-29d4cad50055",
>>   ":jcr:data": 30,
>>   "jcr:mimeType": "text/plain",
>>   "jcr:lastModified": "Mon Aug 06 2012 14:34:44 GMT+0200",
>>   "jcr:primaryType": "nt:resource"
>> }
>> }
>> 
>> If you need to do this from a browser, we might want to finally
>> implement X-Method-Override (SLING-53).
> 
> IMHO there is no need because the POST Servlet allows file upload
> 
> Regards
> Felix
> 
>> 
>> -Bertrand
> 

Reply via email to