At some point in a future build, we'll be able to limit file size uploads in the config, however for now, the below can be used if anyone is interested.
For a single Doc attribute on a form - use the following Advanced Script:
Code: Select all
var oldUpload = config.config.upload;
config.config.upload = function (e)
{
for (var i = 0; i < e.files.length; ++ i)
{
if (e.files[i].size > 10000 /* specify desired size in bytes here */)
{
alert ("file " + e.files[i].name + "." + e.files[i].extension + " is too large");
e.preventDefault ();
return;
}
}
oldUpload.call (this, e);
}
You need to change the following bit of code
Code: Select all
var wc = {
async: {
saveUrl: AwareApp.m_serverUrl + "request.awmu?",
removeUrl: AwareApp.m_serverUrl + "request.awmu?"
},
upload: function (e) {
me.onUploadRemove (e, false);
},
remove: function (e) {
me.onUploadRemove (e, true);
},
error: function (e) {
me.onError (e);
}
};
to this:
Code: Select all
var wc = {
async: {
saveUrl: AwareApp.m_serverUrl + "request.awmu?",
removeUrl: AwareApp.m_serverUrl + "request.awmu?"
},
upload: function (e) {
if (true)
{
for (var i = 0; i < e.files.length; ++ i)
{
if (e.files[i].size > 10000 /* specify desired size in bytes here */)
{
alert ("file " + e.files[i].name + "." + e.files[i].extension + " is too large");
e.preventDefault ();
return;
}
}
}
me.onUploadRemove (e, false);
},
remove: function (e) {
me.onUploadRemove (e, true);
},
error: function (e) {
me.onError (e);
}
};
Code: Select all
if (true)
{
for (var i = 0; i < e.files.length; ++ i)
{
Code: Select all
if (condition when to perform validation)
{
for (var i = 0; i < e.files.length; ++ i)
{