Checks if an attachment exists on a page
Get parameters
- pageName = Page name containing the attachment
- fileName = Name of the attachment to check
Get examples:
// Simple URL
/OpenForum/Actions/AttachmentExists?pageName=/MyPage&fileName=file.txt
// Using JSON.get
JSON.get('/OpenForum/Actions/AttachmentExists', null, 'pageName=/MyPage&fileName=file.txt')
.onSuccess(function(result) {
console.log('Exists:', result);
}).go();
Get Action
Server Side Javascript for GET method
if(typeof(pageName)=="undefined")
{
transaction.setResult(transaction.SHOW_PAGE);
}
else
{
fileName = transaction.getParameter("fileName");
exists = file.attachmentExists(pageName,fileName);
transaction.sendPage(exists);
}