cancel
Showing results for 
Search instead for 
Did you mean: 

Help with UploadContentServlet

dasjlm
Champ in-the-making
Champ in-the-making
Sorry for the dumb question, but I can't find out how I'm suppose to do a browser content upload from a web application.  I'm hoping someone has a small sample as the api doc wasn't any help.

I have created a web application that uses webservices and it was fairly easy to upload a file from the web server but the real challenge seems to be doing a file upload from a browser.

ie: I want to add an upload attachement feature where users can pick a local file and upload right into Alfresco via my web app.

I understand I'm suppose to use the UploadContentServlet but I'm not sure how to code it.

I tried just using a url to Alfresco server but that didn't work and I don't see any how it can resolve "upload" to the servlet.

String url = "http://localhost:8080/alfresco/upload/listing.txt?ticket=" + ticket;

Or am I suppose to include the servlet in my application some how>

Any help/suggestions would be appreicated.
3 REPLIES 3

dozyarmadillo
Champ on-the-rise
Champ on-the-rise
This is just a guess but maybe you can find examples of how to do this in Subversion? Perhaps the Word integration has the code that you're looking for?

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

The UploadContentServlet uses the PUT method to stream content directly into the repositories content store.  I'm not sure that's exactly what you are after.

You want to get content selected on a web page uploaded to the web server and then into the repository.  Right?

If so then have a look a the UploadFileServlet.  This the what the Alfresco web client uses to upload files from the browser.  It may not be exactly what you are looking for, but might give you some clues.

Cheers,
Roy

arnel
Champ in-the-making
Champ in-the-making
Hi All,

Like so many others I'm having a hard time trying to figure out how to call the UploadContentServlet from a regular browser doing a file (content) upload in a form. I'm aware of the fact that PUT's are not allowed in html5- but how to work around this using a browser for the upload?

As suggested on the wiki, I tried to 'tunnel' a PUT in an upload request with the alf_method parameter but I keep getting the HTTP 405 error saying that the POST method is not supported by the servlet. So the parameter is ignored in this case?

This is the test html I used:

<html>

<form action="http://.../alfresco/upload/workspace/SpacesStore/4415ae09-dfc2-437b-a14d-795943e939ce/P123_2T2W1-24H..." method="POST">
<p>
Please specify a file:<br>
<input type="file" name="datafile" size="40">
</p>
<div>
<input type="submit" value="Send">
</div>
</form>

</html>

Then I looked (a long time) for client-side javascript that could do the file upload with a PUT but I didn't find any.

My questions then:
1. Can a PUT to the UploadContentServlet be done in a (regular) browser?
2. If not, what is the simplest alternative to upload new content to a node?

We use Alfresco (3.2r2) as a backend translation workflow system. We don't want translators to have to login to the Alfresco client to do work and instead send them emails with instructions and links to download, upload and commit (approve) their work. Everything works except the upload…

Suggestions?

Regards,
Arne.