07-09-2013 08:16 PM
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.content.setEncoding("UTF-8");
upload.properties.content.guessMimetype(filename);
upload.properties.title = title;
upload.properties.description = description;
upload.save();
// setup model for response template
model.upload = upload;
}
Error Message: 06100003 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/dashlets/sumit.post.js': 06100002 ReferenceError: "companyhome" is not defined. (file:/var/lib/tomcat-7-share/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/sumit.post.js#34)
Server: Alfresco Spring WebScripts - v1.2.0 (Release 1207) schema 1,000
07-10-2013 02:35 AM
07-10-2013 04:22 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.