AnsweredAssumed Answered

Create a file inside repository via Java backed Web Script.

Question asked by cile87 on Nov 29, 2011
Latest reply on Nov 30, 2011 by openpj
I'm using Alfresco 4.0 version.

I'm trying to write a webscript which creates a new file inside alfresco repository (inside folder "/Company Home/myfolder"), but I can't find a way to do it :(

By following http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples examples, I managed to write a webscript which returns a content of a file to user, but how can a java backed webscript generate and store a new (binary) file inside Alfresco repository.

I read a lot of examples and forum posts, but none seem to work for this Alfresco version, or at least I didn't realize how to do it.

I'm using something like:
NodeRef companyHome = repository.getCompanyHome();
List<String> nodes = new ArrayList<String>();
nodes.add("myfolder");

NodeRef where = registry.getFileFolderService().resolveNamePath(companyHome, nodes).getNodeRef();
registry.getFileFolderService().create(where, "myfile",QNAME);
but I don't know what to put for QName parameter. It can't be null.

Thanks.

Outcomes