How to upload a new file to Alfresco using web services?

Uploading a big binary file to alfresco repository using CMIS web services and UploadContentServlet

There are some examples how to upload a file to alfresco using UploadContentServlet but they all show how to code it directly in Java. Documentation and forum lacks an example showing how to upload a large file using Alfresco web services. After a bit of struggle I figured it out.

Quick and dirty recipe:

  1. Perform ticket authorization
POST /alfresco/service/api/login
"username" : "admin",
"password" : "admin"

You’ll get response with ticket in it.

  1. Create a new document using CMIS services
POST /alfresco/service/cmis/i/176c5f4d-db63-49ec-9886-c19d6d9eefce/children

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns=""
<title>important document</title>
<summary>VERY important document</summary>
<content type="text/plain">
<cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId>

/i/176c5f4d-db63-49ec-9886-c19d6d9eefce denotes folder to create document within.

It is also possible to refer to directories in more natural way – using names.

More info provided here: will get quite big chunk of xml with a lot info about newly uploaded document, among these informations you’ll find ID of the document.

3.  Overwrite the new document with your big file

PUT /alfresco/upload/workspace/SpacesStore/85c43689-4a38-4a0a-8e58-e24333ffec14/test.pdf?ticket=TICKET_fc7af4c45f138ad366dd5905aaf7a4ab8b9da268

Send file as body of request.

More info about UploadContentServlet :

And that’s all, your file is ready in Alfresco repository!


  • Hi,

    nice example :) Have you tried uploading anything into admin’s sandbox with this servlet. I’m fighting with correct avm path int this context.

    Regards, beegees.

    P.S. We can always switch to polish :)

    • No I didn’t experiment with admin’s sandbox. Feel free to share your solution if you succeed :) I can also post it here under your name if you like to contribute.

  • Hi
    I need complete example for alfresco and java implementation. Can u please suggest me.Waiting for ur reply. Thanks in advance

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>