Post Action Uploads an image file and appends it to a page with a title and description.
Post Data
- page - The page to attach the image to
- fileName - The name of the image file
- title - The images title
- description - A description of the image
Server Side Javascript for POST method
post.sjs
transaction.getPostFileData();
fileName = transaction.getPostParameter("fileName");
pageName = transaction.getParameter("page");
transaction.userCanPerformAction(pageName,"update",true);
title = transaction.getPostParameter("title");
description = transaction.getPostParameter("description");
user = transaction.getUser();
wiki.addJournalEntry("File ["+pageName+"/"+fileName+"] added to Page ["+pageName+"] by "+user);
tags = js.getPageAttachmentAsString(pageName,"tags.txt");
data = js.getPageAttachmentAsString(pageName,"page.wiki");
data = data+'[{Photograph src="'+fileName+'" title="'+title+'" description="'+description+'"}]';
savePage( pageName,data,tags );
page = wiki.buildPage(pageName);
transaction.goToPage(pageName);