cancel
Showing results for 
Search instead for 
Did you mean: 

Any examples of a java web service upload?

jcblitz
Champ in-the-making
Champ in-the-making
I searched around the web and the forum looking for an example of a web service that uploads a file. I saw the post http://forums.alfresco.com/viewtopic.php?t=7346 but the author never replied back that everything is working. I tried that code and modifying it to use my space and data but I'm getting some errors that I'm not familiar with. Rather than barking up that tree just yet, does anyone have any code examples of a file upload using the web service?
-
It figures, as soon as I post this I get something working. That thread I mentioned earlier does work, the path to my space was wrong. I referenced another test I wrote and noticed the discrepancy.
2 REPLIES 2

dooley
Champ in-the-making
Champ in-the-making
create a variable like topic or content, doesn't matter.  Use the node browser to find the path to where you want to upload your file.  I used javascript and called the childByNamePath function.  Here is an example of my code:

var topic = companyhome.childByNamePath("Data Dictionary/my forum space/dooley's forum/dooley's topic");

create another variable called upload and call the create file function and write the content

upload = topic.createFile(filename);
upload.properties.content.write(content);
upload.save();
model.upload = upload;

Hope this helps

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi

Same problem i am also facing. I am new to Webservices API.
My task is i have to upload a file from client machine to alfresco server machine.
In webservicesample program, we r creating file by program.
In my case, Client scan some docs and he'll upload that scanned docs on alfresco server.
Client application is a web application.
Through webservices we have to fatch that file from client application and upload on alfresco server.
Kindly help me.

Regards
Nishant