cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the content url

success
Champ in-the-making
Champ in-the-making
Hi alls:
    there i s a problem I confronted when I dedicated to developing Alfresco share.the details are as follows:
    Assuming that I had uploaded files in Alfresco share.and now I want to download the files that are exists in Document Library ,the demand is I want to through a hyperlink to download the file,How can I get the content url ? As soon as  I click the hyperlink then download a file. How can I set the content URL of a hyperlink to a uploaded file in Alfresco share?
9 REPLIES 9

sujaypillai
Confirmed Champ
Confirmed Champ
If you click on the link for any content in document library it takes you to the preview page, where in you may find three options to the right :

1. Download File URL
2. Document URL
3 This Page URL

These are the links available for downloading the specific content.

Hope so that helps you.

success
Champ in-the-making
Champ in-the-making
Hi,sujaypillai,you misunderstood my problem ,perphaps I didn't describle it clearly.
The really problem I'm encountered  the problem is that how can i get the definite directory. e.g :Assumping that I had upload a file named 'experience.doc' ,but the download url is  http://127.0.0.1:8080/share/proxy/alfresco/api/node/content/workspace/SpacesStore/dee5baea-1b01-4d5b... is some Random characters like 'dee5baea-1b01-4d5b-b422-715568dda855' ,and how did these characters produced ?The url is file server site? and I have found the file I upload is located in contentStore(alf_data folder) , Is that true? or the file upload and download through file server? thank you very much!

success
Champ in-the-making
Champ in-the-making
In brief,my problem is How could I assign a content url when i'm programming if I want to download a file ? the UI present a hyperlink ,when I click it then download a file.

sujaypillai
Confirmed Champ
Confirmed Champ
To let you know everything in Alfresco is a node and each node has an unique identifier.

Say when you uploaded the content (experience.doc) into Alfresco it creates a new node which is identified by
'dee5baea-1b01-4d5b-b422-715568dda855' (This is called node-uuid).

To know more about this node navigate to Administration Console > Node Browser > workspace://SpacesStore.
Make sure that the dropdown has value 'noderef' and in the text box enter value -
workspace://SpacesStore/dee5baea-1b01-4d5b-b422-715568dda855
and click on Search.

The result what you get is all the properties, aspect, Permission, Children, Parent and Association related to this node.


Now to get the download url of the above content in programming (webscripts in this case) make use of the ScriptContent API.

Read more here : http://wiki.alfresco.com/wiki/3.4_JavaScript_API#ScriptContent_API

success
Champ in-the-making
Champ in-the-making
Thanks,sujaypillai .you help me a lot.
       there is exist some problems.How did this  identifier(dee5baea-1b01-4d5b-b422-715568dda855)  be  produced ? is produced randomly
by system ?  if there is convenient for you , Do you mind offering me some demos about get the download url by making use of the ScriptContent API ? because I' m a freshman in Alfresco. thank you very much.

sujaypillai
Confirmed Champ
Confirmed Champ
Sorry I can't run you through a demo but there exists a webscript in alfresco which can be used for reference. Try to navigate to http://localhost:8080/alfresco/service/index (assuming that you have alfresco running on local machine with default configuration).

Click on "Browse by Web Script Package" .

Click on /org/alfresco/sample

Try to understand the "folder listing sample" and click on "GET /alfresco/service/sample/folder/{path}"
Replace {path} by Company%20Home to get the url as below:
http://localhost:8080/alfresco/service/sample/folder/Company%20Home

and see the magic  Smiley Happy

Also please do refer to this : http://www.slideshare.net/JM.Pascal/alfresco-in-few-points-node-tutorial-521030

Hope so that helps you out.

If "yes" then i deserve a point for that  :wink:

success
Champ in-the-making
Champ in-the-making
At first,I'd love to say thanks to you! you help me a lot. Smiley Happy  and i had assigned points to you!

       Now ,i'm  a little of confused to how to start! anyhow ,thank you very much!   Smiley Happy

jeniferjohn
Champ in-the-making
Champ in-the-making
You can use wget command to download the page and read it into a variable as:

content=$(wget google.com -q -O -)
echo $content

We use the -O option of wget which allows us to specify the name of the file into which wget dumps the page contents. We specify - to get the dump onto standard output and collect that into the variable content. You can add the -q quiet option to turn off's wget output.

You can use the curl command for this aswell as:

content=$(curl -L google.com)
echo $content

We need to use the -L option as the page we are requesting might have moved. In which case we need to get the page from the new location. The -L or –location option helps us with this.

success
Champ in-the-making
Champ in-the-making
Hi,jeniferjohn ,thank your advice.
          you mentioned use wget command to get content url.but according to my comprehension,the wget command is limited on Linux/Unix platform , it's not suitable for windows platform.