Help and/or Example with the file upload webscript

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2011 05:25 PM
I am looking at the Restful API Reference (http://www.alfresco.com/help/33/enterprise/api/) and trying to understand how to use the file upload web script. Currently, the api Reference seems severely under documented.
Does this mean the service is expecting (multipart/form-data)? or is it expecting XML or something else?
What is "HTML type file"?
I tried this web script with the following form, assuming that since filedata is the only marked as mandatory that it would work
But it returned the following:
What parameters are missing?
The web script uses the following HTML form data
Does this mean the service is expecting (multipart/form-data)? or is it expecting XML or something else?
filedata - (mandatory) HTML type file
What is "HTML type file"?
I tried this web script with the following form, assuming that since filedata is the only marked as mandatory that it would work
<form method='POST' enctype='multipart/form-data' action='http://localhost:8080/alfresco/service/api/upload'> File to upload: <input type="file" name="filedata"><br /> <input type=submit value=Press> to upload the file! </form>
But it returned the following:
{ "status" : { "code" : 400, "name" : "Bad Request", "description" : "Request sent by the client was syntactically incorrect." }, "message" : "Required parameters are missing", "exception" : "", "callstack" : [ ], "server" : "Community v3.4.0 (b 3262) schema 4,111", "time" : "Mar 18, 2011 3:24:31 PM"}
What parameters are missing?
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2011 10:16 AM
You have to set all these parameters in your HTML form, as you can see using the WebScripts index:
- filedata, (mandatory) HTML type file
- siteid
- containerid
- uploaddirectory
- updatenoderef
- filename
- description
- contenttype
- majorversion
- overwrite
- thumbnails
The new file must be dropped in one of the Alfresco spaces, this means that you need to set uploaddirectory and the contenttype to specialize the node as you want. The filename is important because Alfresco use this attribute to build the primary path for the content.
Another way is based on implementing your own WebScript following the upload form example webscript to customize some behaviour if you need:
http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload
Hope this helps.
- filedata, (mandatory) HTML type file
- siteid
- containerid
- uploaddirectory
- updatenoderef
- filename
- description
- contenttype
- majorversion
- overwrite
- thumbnails
The new file must be dropped in one of the Alfresco spaces, this means that you need to set uploaddirectory and the contenttype to specialize the node as you want. The filename is important because Alfresco use this attribute to build the primary path for the content.
Another way is based on implementing your own WebScript following the upload form example webscript to customize some behaviour if you need:
http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload
Hope this helps.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2011 10:40 AM
Another way is based on implementing your own WebScript following the upload form example webscript to customize some behaviour if you need:
http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload
Hope this helps.
Hi,
How can we use this in share ? the "companyhome" is not defined there…
Thanks
