cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading file problem

dark_rider
Champ on-the-rise
Champ on-the-rise
We have an applet and have to send a file. We try to perform with default upload restful service ("http://localhost:8080/share/proxy/alfresco/api/upload")
I have read and analyzed this topic ( http://forums.alfresco.com/en/viewtopic.php?t=13652 )  but not achieved.
I get the http 401, http 500 error responses from server

Could you please help me?
4 REPLIES 4

openpj
Elite Collaborator
Elite Collaborator
I think that URL is the proxy of Share for Alfresco, so probably it is a different connector.

You should try to use the default Alfresco (and not Share) REST Upload service at the following URL:
/alfresco/service/api/upload

Package: /org/alfresco/repository/upload 

File Upload
POST /alfresco/service/api/upload

Upload file content and meta-data into repository.
HTML form data
filedata, (mandatory) HTML type file
siteid
containerid
uploaddirectory
updatenoderef
filename
description
contenttype
majorversion
overwrite
thumbnails

Return content
nodeRef

Otherwise if you need to upload large files you can use the UploadContentServlet using the PUT HTTP method for your content (the node must be created  before upload the content), for more information you can take a look at this address:
http://wiki.alfresco.com/wiki/URL_Addressability#UploadContentServlet

Hope this helps.

dark_rider
Champ on-the-rise
Champ on-the-rise
I have tried your suggestion, it asked me username and password and get same error
From (ServerResponse): java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/alfresco/service/api/upload

Using this link "http://localhost:8080/share/proxy/alfresco/api/upload" , it does not ask me username and password but same error occurs. I do not understand how share site could perform to upload.

I am getting the same error
From (ServerResponse): java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/share/proxy/alfresco/api/upload

As uploading file via Http and java, the samples are very simple and similar like the following links:
http://www.hiteshagrawal.com/java/http-post-file-content-in-java
http://www.jguru.com/faq/view.jsp?EID=62798

What am I supposed to do? Thanks for your help.

dark_rider
Champ on-the-rise
Champ on-the-rise
Is there any suggestion?

dark_rider
Champ on-the-rise
Champ on-the-rise
The problem has been solved by using MultipartEntity object.