How to show current uploaded image in mendix?

0
Hey, I have a problem. I'm currently working on a page that when a file (PDF, PNG, JPG and the like) is uploaded to File manager, it should display in a separate column in a separate data view that file that was uploaded. I'm a bit confused about how to do this, I've tried with plugins from marketplace and custom HTML but it doesn't quite work as it wants. Do you have any ways to dynamically display such files?
asked
3 answers
1

Hi Jakub,

 

Please explore the below widget which will solve your purpose,

File Dropper

 

Hope it helps!

Thanks & Regards,

Manikandan K

answered
0

Steps:

1. First create an entity in your domain model say "TempUpload" and set generalization to System/Images or System/Files.

 

2. Add a dataview container to your page and set data source as a new Microflow. Create a new microflow which must do must do two things:

        1) Create an object of entity "TempUpload"

        2) Return the newly created object at the end of microflow

 

3. Add 2 columns in your data container using layout widget. On the left add the File or Image Uploader widget and on the right column add a List view container. Add a heading above the list as "Uploaded Files/Images".

 

4. Set the data source of the List container as entity "TempUpload".  Add a dynamic image widget inside the list. Set the image source to "TempUpload". Set height and width to 100px each (Optional). Now this list will display all the newly uploaded files/images.

 

5. Below the file/image uploader widget on the left, add a save object button. We will add custom save logic. Set the onclick action of the button to a new microflow. Create a new microflow that will do the following:

         1) Commit the "TempUpload" object

         2) Show the current page.

         3) show a message "Image Uploaded successfully".

 

We are again showing/loading the current page because it will again create a new object for next image.

 

This is how you can upload images and simultaneously show the newly uploaded images as a list.

answered
0

If you already uploaded the image using the standard Mendix image upload widget and you just want to show the image that has been uploaded, place a dataview on the page to retrieve the image and then use the standard dynamic image widget from Mendix (see images below). If needed, you can add a refresh of the parent object to make it immediately visible on the page.

 

image.png

image.png

answered