cancel
Showing results for 
Search instead for 
Did you mean: 

Upload document whith java to Alfresco

rhakaro
Champ in-the-making
Champ in-the-making
Hi, I´m developing a Java application, and I need to upload a document to Alfresco using Java code. I know an API (SDK Alfresco) but I don´t know how to use it well. Can you write me any example please???

Sorry for my English (I´m Spanish) and thanks for read me  !!
(PLEASE; HELP MEEEEEEE  Smiley Tongue )
4 REPLIES 4

zaizi
Champ in-the-making
Champ in-the-making
Have a look at this http://wiki.alfresco.com/wiki/URL_Addressability#UploadContentServlet.

It is a simple and easy way to upload content into Alfresco. Alternatively, you can always mount Alfresco repository using CIFS and just saved your files to the file system.

rhakaro
Champ in-the-making
Champ in-the-making
Oooook, thak you very very much!!!
I,m going to try this servlet on my code. Byee!!

pablogpa
Champ in-the-making
Champ in-the-making
Hi, I'm having problems uploading files with the uploadContent Servlet
I get a ticket with the webservice
I make the http connection so it returns
contentUrl=store://2008/7/9/14/40/33667e74-4db4-11dd-a714-616a2605cccf.bin|mimetype=application/pdf|size=322389|encoding=UTF-8|locale=es_ES_
and I end the session with the ticket…

and the file is missing!!, I can't find it in Alfresco


//Getting the ticket

          String url = "http://myserver:8080/alfresco/upload/uploadinghttp.pdf?ticket='+ticket;
          URL server = new URL(url);
          HttpURLConnection connection = (HttpURLConnection)server.openConnection();
          connection.setRequestMethod("PUT");
          connection.setDoOutput(true);
          connection.setDoInput(true);
          connection.connect();
         
          OutputStream cosa = connection.getOutputStream();
          cosa.write(aos.toByteArray());
          cosa.flush();
          System.out.println("code: "+connection.getResponseCode());
          InputStream is = connection.getInputStream();
          int c;
          while ((c=is.read())!=-1){
             System.err.print((char)c);
          }

//End session

What am I doing wrong?
Thanks

lakshya
Champ in-the-making
Champ in-the-making
Hello  pablogpa,
I am also facing the same problem.
Did you find the solution??
If yes Please post the solution…..