08-01-2010 08:00 PM
08-01-2010 08:35 PM
<webscript>
<shortname>File Upload Form Sample</shortname>
<description>Form for uploading file content and metadata into Repository</description>
<url>/sample/upload</url>
<authentication>user</authentication>
</webscript>
08-01-2010 08:42 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.mimetype = "UTF-8";
upload.properties.title = title;
upload.properties.description = description;
upload.save();
// setup model for response template
model.upload = upload;
}
08-12-2013 07:29 AM
04-03-2014 12:08 PM
04-04-2014 08:13 AM
var espacio = search.xpathSearch("app:company_home/cm:Mi_x0020_carpeta")[0];
var doc = espacio.createFile("upload" + espacio.children.length + "_" + filename);
var espacio = companyhome.childByNamePath("Mi carpeta");
var doc = espacio.createFile("upload" + espacio.children.length + "_" + filename);
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.