How to attach/upload image in a Wizard of the Confluence Blueprint Plugin?


Is there a sane way to upload an image through the wizard of a blueprint? I want to be able to attach multiple images on the wizard, and on page creation, display the images along side other form content.

I tried to implement the .attachmentsPanel template but haven't been able to configure the file upload. Is there a way to handle file upload on postRender? Like you can handle labels using the name="lablelsString" in the <input> field.

If I put the following code in the form, is there a way to use an Ajax call on postRender to upload the 
selected files?

<div class="upload-field field-group"> <label for="uploadFile">Upload file</label> <input class="upfile" type="file" id="uploadFile" name="uploadFile" title="upload file"> </div>

I'm just stuck on trying to figure out a path to go about this issue. Any help would 
be appreciated.

1 answer

1 accepted

Use AJS postRender for the blueprint wizard page to make an ajax call to a servlet to create a dummypage/space. Get the dummy page/space homepage id, make an ajax rest call to upload image to the dummy page. On BluePrintCreateEvent, copy the attachment from the dummy page/space homepage to the created page/space homepage. Then delete the dummy page/space's homepage within the same EventListener class. Through postRender in the javascript make another ajax call to the servlet to delete the dummy page and its attachments on clicking back or close.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Sarah Goff-Dupont
Published 4 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

56 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you