cancel
Showing results for 
Search instead for 
Did you mean: 

upload content from jsf project to alfresco

azade
Champ in-the-making
Champ in-the-making
hi
i want to upload file from my seam page directly to alfresco but i dont know what have to do i work with communityalfresco3.3
and change datebase to postgres i want alfresco to customize that use in part of mu big project but i dont know relation between them
please help me
2 REPLIES 2

openpj
Elite Collaborator
Elite Collaborator
You can use the REST API of Alfresco using one of the WebScripts exposed.
You can find more information about WebScripts here:
http://wiki.alfresco.com/wiki/Web_Scripts

You can follow two ways to upload a file into the repository.

You can only to execute a POST HTTP in this way to upload a file:
File Upload
POST /alfresco/service/api/upload

Upload file content and meta-data into repository.
HTML form data
filedata, (mandatory) HTML type file
siteid
containerid
uploaddirectory
updatenoderef
filename
description
contenttype
majorversion
overwrite
thumbnails

Return content
nodeRef

Or you can use 2 separate calls: one to create the node and another to create the content for the node.
This is the first call to execute to create the node:

Create folder or document (createDocument, createFolder)
POST /alfresco/service/api/node/{store_type}/{store_id}/{id}/children
POST /alfresco/service/api/path/{store_type}/{store_id}/{id}/children

Creates a document object of the specified type, and optionally adds the document to a folder

Inputs:

ID typeId: Document type
Collection properties
(Optional) ID folderId: Parent folder for this new document
(Optional) ContentStream contentStream
(Optional) Enum versioningState: CheckedOut, CheckedInMinor, CheckedInMajor (Default)

This is the second call to upload using a PUT HTTP the stream of the file into the new node:

Content Write (setContent)
PUT /alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}?overwriteFlag={overwriteFlag?}
PUT /alfresco/service/api/path/content{property}/{store_type}/{store_id}/{id}?overwriteFlag={overwriteFlag?}
PUT /alfresco/service/api/avmpath/content{property}/{store_id}/{id}?overwriteFlag={overwriteFlag?}
PUT /alfresco/service/api/node/{store_type}/{store_id}/{id}/content{property}?overwriteFlag={overwriteFlag?}
PUT /alfresco/service/api/path/{store_type}/{store_id}/{id}/content{property}?overwriteFlag={overwriteFlag?}

TODO

Authentication:   guest
Transaction:   required
Format Style:   argument
Default Format:   text
Lifecycle:   draft_public_api
Id:   org/alfresco/repository/store/content.put
Descriptor:   classpath:alfresco/templates/webscripts/org/alfresco/repository/store/content.put.desc.xml

I have copied all this snippet from the WebScript servlet that you can find here in your Alfresco installation:
http://localhost:8080/alfresco/service/index/all
Hope this helps.

azade
Champ in-the-making
Champ in-the-making
thanks for reply
i see these but please give me a complete example from these addresses that i can use them
please help