function placeFiguresOnWiki_2 (dirnow,dirmat)

%% prepare operations
basepath = 'p:\mctools\matlab';
cd(basepath);mcsettings;cd(dirmat);

rundir   = fileparts(mfilename('fullpath'));
addpath(rundir);
addpath([rundir filesep 'code']);

%% initialise WIKI settings
service    = ConfluenceSoapServiceService('http://public.deltares.nl');;
spacekey   = 'MICORE';

%% get page information
pagetitle  = 'Egmond Beach';
           page       = getPage(service, activateService(service,'bot', 'bot123'), spacekey, pagetitle);

fns = dir([dirnow '\*.png']);
for i = 1 : length(fns)
    clear in2;
    in2.contentType = 'png';
    in2.fileName    = fns(i).name;
    in2.pageId      = page.id;
    in2.title       = page.title;
    in2.url         = page.url;

    handle = fopen([dirnow '\' fns(i).name]); binarydata = fread(handle); fclose(handle);

    addAttachmentReturn = addAttachment(service,activateService(service,'bot','bot123'),page.id,in2,base64encode(binarydata));
end

web   ('http://public.deltares.nl/display/MICORE/Egmond+Beach');

