cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer files from the alfresco outside

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

Is there any way I can copy files from my alfresco to different location outside the alfresco?

Thank you in advance
12 REPLIES 12

kevinr
Star Contributor
Star Contributor
Alfresco supports the FTP, CIFS and WebDav protocols for external access.

Thanks,

Kevin

itayh
Champ in-the-making
Champ in-the-making
Thank you for the quick response Kevin.


To be more specific what I actually want is to run a rule on a space that the results will be coping the files to specific location outside the alfresco.
Is it possible using FTP in javascript?

Thank you,
  Itay

kevinr
Star Contributor
Star Contributor
You would need to write some java code for this, a custom Repository Action class - which you can then call from javascript if that helps.

Thanks,

Kevin

itayh
Champ in-the-making
Champ in-the-making
Thank you Kavin,

In case I will like to copy the files from alfresco (in my local machine) to my local machine from javascript action, can I do it without FTP?

Thx alot

kevinr
Star Contributor
Star Contributor
In theory yes. Your java class could write directly to the file system or what it needed to do. You can put whatever code you like in the java action class. Then you call the action class from javascript, passing whatever arguments are appropriate.

Thanks,

Kevin

itayh
Champ in-the-making
Champ in-the-making
Thank you Kavin.

Using java.io.File I can write files from the java script to my local machine. However I can not copy the alfresco contents (they are represented as nodes and java.io.File don't recognize it).

In case I will write java class for that how will it get the alfresco content? I mean how will it connect to the repository? (ws, java api..)

Thax alot

kevinr
Star Contributor
Star Contributor
No you won't be able to use the java.io.File class anyway from JavaScript as we have disabled that feature in our scripts.

I suggest you read up on the Alfresco Java APIs - you will need to use the ContentService to retrieve a ContentReader object from the noderef of the item you want to read, then there are APIs on the ContentReader objects to get the actual file content. You will need to do all this in a Java class as a repository action, and then call that action from JavaScript.

Thanks,

Kevin

shay
Champ in-the-making
Champ in-the-making
Hi,

i wrote a java code and i need to call it from a javascript.
can anyone give an example of code for this problem?

Thanks in advance,
Shay.

kevinr
Star Contributor
Star Contributor
You need to create a repository Action object as you Java code, you can then use the Actions API in JavaScript to call it:
http://wiki.alfresco.com/wiki/Custom_Actions
http://wiki.alfresco.com/wiki/JavaScript_API#Actions_API

Thanks,

Kevin