var filename = null;
var content = null;
var title = "";
var description = "";
// locate file attributes
for each (field in formdata.fields)
{
if (field.name == "title")
{
title = field.value;
}
else if (field.name == "desc")
{
description = field.value;
}
else if (field.name == "file" && field.isFile)
{
filename = field.filename;
content = field.content;
}
}
// ensure mandatory file attributes have been located
if (filename == undefined || content == undefined)
{
status.code = 400;
status.message = "Uploaded file cannot be located in request";
status.redirect = true;
}
else
{
// create document in company home for uploaded file
upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ;
upload.properties.content.write(content);
upload.properties.encoding = "UTF-8";
upload.properties.title = title;
upload.properties.description = description;
upload.save();
// setup model for response template
model.upload = upload;
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.