cancel
Showing results for 
Search instead for 
Did you mean: 

web script upload modification

tsgpartner_mui
Champ in-the-making
Champ in-the-making
Hi

I created an upload web script that is able to get files and upload them into alfresco.  Its similar to the upload web script example given in the 'alfrescowiki webscripts example' documentation. 

What I want to modify is the location of where all the files are being uploaded to, which is the company home space under content items.  I've been tryin to figure out how to just upload files anywhere else besides company home (e.g. data dictionary space, guest home, or even more ideally into the webscripts space).


this is the code in the upload javascript

  // create document in company home for uploaded file
  upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename);


I know companyhome is some default script node, and I tried using other default script nodes mentioned in the wiki, but to no prevail (e.g. userhome, space, document, dictionary, etc.).  Usually, I get an error saying the 'space cannot be found'. 


I did some searches in the Alfresco repository and found like paths, maybe I can set a variable equal to a path

e.g. 'guest home'
var guesthome = /${spaces.company_home.childname}/${spaces.guest_home.childname}

and then use that variable name to replace companyhome, but i'm not sure if thats right at all.


If any one can help, thanks.

-Boniface
4 REPLIES 4

stijndereede
Champ in-the-making
Champ in-the-making
Are you authenticated when you post to the web script? What is in your upload.post.desc.xml under <authentication>…</authentication>? If it says none or guest, then you cannot save anything to the repository. The companyhome variable in js in then simply not available.

tsgpartner_mui
Champ in-the-making
Champ in-the-making
I have 'admin' entered for my authentication tags.

and I always had the script to work with companyhome, what I would like to do is to upload files somewhere in the repository besides companyhome space.

tsgpartner_mui
Champ in-the-making
Champ in-the-making
i got it to work now.

fromano
Champ in-the-making
Champ in-the-making
Could you please tell us how you got it to work????
Thanks