cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading somewhere other than company home

mellen
Champ in-the-making
Champ in-the-making
Hi,

I have followed the example in http://wiki.alfresco.com/wiki/Web_Scripts_Examples#Upload_Form to upload files to the alfresco repository. The files always end up in the company home space. how do I specify the space I want to use?

eg. company home/user homes/abritrary space

Cheers,
Mellen.
3 REPLIES 3

mellen
Champ in-the-making
Champ in-the-making
I've solved my query.

To select the space you want to upload to do this (if the space is in user homes):
var space_to_use = companyhome.childByNamePath("User Homes/path/to/space");
where "path/to/space" is the path to your desired space.

then to create the file in the selected space, change the file upload example
from
upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ;
to
upload = space_to_use.createFile("upload" + space_to_use.children.length + "_" + filename) ;

fgjohnson
Champ in-the-making
Champ in-the-making
Thank you.
This works fine.
I was incorrectly assuming I needed 'companyhome' as a global at the beginning of the Path.

Note for Newbies…
Use the true path of where you want it to go.

e.g. 
var space_to_use =  companyhome.childByNamePath("Sites/uploads/documentLibrary/Uploads");
var space_to_use =  companyhome.childByNamePath("Shared/Images");
var space_to_use =  companyhome.childByNamePath("User Homes/reviewer/Review");


Hope this helps.

leticiafloresfr
Champ in-the-making
Champ in-the-making
Hola buen día:

Gracias por su aportación, resulto de gran ayuda
Saludos