AnsweredAssumed Answered

Loss of properties on upload

Question asked by fromano on Sep 23, 2015
Latest reply on Sep 28, 2015 by fromano
Hi,
Have created a form to upload a document similar to tutorial in wiki using Community 5.0.1.d.

When I modify the destination for the uploaded form from the default of companyhome, the document loses the properties of title and description:

TUTORIAL // create document in company home from uploaded file
  upload = companyhome.createFile(file.filename) ;
  upload.properties.content.guessMimetype(file.filename);
  upload.properties.content.write(file.content);
  upload.properties.title = title;
  upload.properties.description = description;
  upload.save();
  // setup model for response template
  model.upload = upload;

MY VERSION  // create document in company home from uploaded file
  upload = companyhome.childByNamePath("/Guest Home/Supplier Assessments (BO-13)").createFile(file.filename) ;
  upload.properties.title = title;
  upload.properties.description = description;
  upload.properties.content.guessMimetype(file.filename);
  upload.properties.content.write(file.content);
  upload.save();
  // setup model for response template
  model.upload = upload;

Using the .childByNamePath command gets the file uploaded tothe proper destination in share, but the document does not retain the above two properties.

Can anyone explain this and offer a workaround?

Thank you in advance,
Frank

Outcomes