Upload file API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 11:22 AM
I wanted to write code using ALFRESCO API's to upload a document, which API should I use to upload.
ALFRESCO DEVELOPERS: Can you people walk me through the skeleton of how-to go about this?
Also the following questions
1. The uploaded file will be stored in back end (MySQL) - is my understanding correct?
2. Can I design my application so as to have important information about the document (something like meta data abou the doc) to be input by the user and store that as well, if so how should I go about storing the document and the meta data of it in backend, does that require a new table to be designed or can I tweak to add new fields of an existing table (that u people have designed), if so which table?
Thanks
Raja
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2006 06:02 AM
Cheers
Paul.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2006 07:38 AM
Thanks for the reply on Upload File. I went through UploadFileServlet.java in org.alfresco.web.app.servlet
import org.alfresco.web.bean.FileUploadBean;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
I visitied the Java API for Alfresco - http://www.alfresco.org/resource/docs/java/repository-service-api/index.html
But I couldn't spot the FileUpload related API's there (the file upload packages are mentioned above), kindly help me on this.
Thanks
Raja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2006 12:00 PM
The user guide is very good. I was just looking at this today.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 05:39 AM
I understood the nuances in getting a file uploaded. I presume Alfreso uses the Apache's Common Fileupload utility. Sorry if the following issues are very rudimentary for you developers.
As JSF is used, I have my doubt about what is equivalent for HTML input type="file"? Any JSP file in Alfresco code has this?
Also I came across the possibility of doing the same upload using MyFaces
(the link is as follows
http://www.onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=1
)
Why has Alfresco developers opted for the Commonsupload utility? Also how should I implement my input type="file" in a JSP page, from where I can utilize the FileUploadServlet class and upload a file.
Kindly reply, thanks in advance
Thanks
Raja

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:46 AM
To use the MyFaces approach you need to have a servlet filter configured in your app. In the portal environment servlet filters don't work so you can't upload files

We have had to implement a way to allow uploading in both scenarios. We therefore use the commons fileupload project directly and deal with the differences appropriately.
The page in the app that performs the upload is /projects/web-client/source/web/jsp/wizard/add-content/upload.jsp. In this file you'll notice the use of…
<r:uploadForm>
…this is a simple Alfresco JSF component that outputs the relevant <form> tag for the fileupload. This form tag is different for portal and servlet containers hence the reason it's slightly hidden.
So to use the file upload capability in your own app simply use <r:uploadForm> in the way upload.jsp does.
One thing to be aware of though, the upload is done in a separate form, this is because we want to upload the file to the servlet directly and not go through the JSF lifecycle.
Hope this answers your questions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 11:00 AM
Is only the "uploadForm" necessary? or are there other components where i could be reffering to?
http://forums.alfresco.com/viewtopic.php?t=1505
greetings

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 04:11 PM
Have you tracked down at which point it doesn't find something it should find i.e. is your QuickUpload bean found in the code you have added to browse.jsp?
If not, you could try the org.alfresco.web.app.servlet.FacesHelper object, it has a getManagedBean method that may help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2006 02:01 AM
If i upload a file in upload.jsp, and I go back to browse.jsp, then the message getFileUploadSuccessMsg is been showed.
If i upload a file in browe.jsp, then notthing happend.
also, when I upload a file in "update-file", and then, when i go to browse.jsp, the message is been showed.
browse.jsp
<r:uploadForm> <td style="padding-left:4px" align=right> <input type="file" name="alfFileInput"/> </td> <td style="padding-left:4px" align=left> <input style="margin-left:12px;" type="submit" value="<%=Application.getMessage(FacesContext.getCurrentInstance(), "upload")%>" /> </td> <% AddContentWizard wiz = (AddContentWizard)session.getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + "AddContentWizard"); if (wiz == null) { wiz = (AddContentWizard)session.getAttribute("AddContentWizard"); } if (wiz != null && wiz.getFileName() != null) { %> <td> <%=wiz.getFileUploadSuccessMsg()%> </td> <% } %> </r:uploadForm> <td> <h:commandButton style="margin-left:12px;" value="#{ourmsg.quick_upload}" action="#{AddContentWizard.quick}" disabled="#{AddContentWizard.fileName == null}" />
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2006 09:20 AM
Is your upload form working ? Because I want to do the same. Is it possible to share your code please ?
Thanks in advance !
Cheers,
Samuel
