Alfresco uploader with Curl

Let see a simple shell script example to upload content to Alfresco repository using RESTful API.

Requires Curl package to be installed on your system. Just set ALFRESCO_SERVER, USERNAME and PASSWORD variables in script before start it…

#!/bin/bash
#
# Alfresco upload script with CURL by LouiSe@louise.hu
#
# Usage: alfresco_uploader.sh    
#
# ./alfresco_uploader.sh /tmp/some.pdf someSite documentLibrary someDir
#

ALFRESCO_SERVER=http://localhost:8080/alfresco
USERNAME="admin"
PASSWORD="admin"

#CURL_VERBOSE=-v
CURL_VERBOSE=-s
CURL_METHOD=POST
FILENAME=`basename $1`
MIMETYPE=`file --brief --mime-type $1`
CONTENTTYPE="cm:content"
UPLOAD_SERVICE_URL=${ALFRESCO_SERVER}/service/api/upload

echo "Uploading: ${FILENAME} ($MIMETYPE) to ${ALFRESCO_SERVER}"

curl ${CURL_VERBOSE} -k -X ${CURL_METHOD} \
    --user "${USERNAME}":"${PASSWORD}" \
    -F filedata=@$1 -F siteid="$2" -F containerid="$3" \
    -F uploaddirectory="$4" \ -F filename="${FILENAME}" \
    -F contenttype=${CONTENTTYPE} "${UPLOAD_SERVICE_URL}" \
    | grep 'description' | cut -d ':' -f 2 | tr -d '\"'

Example:

$./alfresco_uploader.sh ~/Desktop/advanced-workflow-article.pdf demo documentLibrary someDir
Uploading: advanced-workflow-article.pdf (application/pdf) to http://localhost:8080/alfresco
 File uploaded successfully
 

ExtAlf – Alfresco by ExtJS

ExtAlf demo in Safari

I’m working on a new ExtJS wrapper (ExtAlf) – inspired by Opsoro – for Alfresco document and workflow management functions (by webscripts), like foldertree, document properties, preview, etc. This is not an Opsoro or FlexSpaces alternative, rather than a developer toolkit or a simple SDK what supports embedding Alfresco backend functionality into Web2.0/AJAX portals and frontends.

Link: Collaborative Editor

ExtAlf in Aptana

Planned features:

  • – folder tree panel with actions (show folder contents, create new folder, move folder)
  • – document grid panel with actions (preview, download, show properties, delete, rename, move to other folder, upload new document)
  • – property grid with editing fields
  • – content preview with document transformation
  • – task list and management (close, create, forward)
  • – user interface localization
  • – limit root nodeRef to browse (just like Customer Portal engines)
  • – simple search
  • – simple discussion forum
  • – different grids to show document in a folder with custom properties
  • – integrated document editor for plain text, html and form contents

Search dialog and results with auto-preview:
ExtAlf Search

Login dialog:

ExtAlf Login window

Floating panels on UI:
ExtAlf Demo2 - floating panels

Continue reading ExtAlf – Alfresco by ExtJS