I have a form on a web page, the form includes a file input field. I have followed one of the tutorials below to show thumbnails of the chosen images before upload. All good.
My problem...
If I select two images (as per screenshot above) and decide to add a third image, I would click on "Choose your file(s)..." again and select the additional image, BUT I then lose the first two images. Not good.
This happens on both desktop and mobile device.
On a desktop machine I may want to select two images but from different folders, this can't be done.
On a mobile device I may wish to add three images and also take two photographs all to be uploaded in a single form, but this won't work.
This is how the File Input Properties are set...
Help please, I know this can be done with php because I have done it prior to Wappler.
Hi Neil,
The default behavior of HTML 5 file input is to allow selecting images from one folder.
If you select different images after you have already added some, then they get removed and the new files are added.
Thatâs not something we control, itâs the default behavior for the multi upload inputs.
@Teodor, how can I access the wording in the middle of the dropzone to change it dynamically?
ie on desktop to say âClick to choose from folder or drag and drop hereâ
and on mobile to say âClick to choose from gallery or to take a pictureâ
Also, how can I access the image data so I can create a list above or below the Dropzone with the filename, file size, running total in Mb and running total of images?
I know I can use CSS to change the classes dmxDropzoneFilename and dmxDropzoneFilesize of the individual thumbnails within the Dropzone but we want to make some of the form layouts look different.
Some will just have thumbnails, some just a worded list, and some with thumbnails but with separate list.
If you add a custom message, you will see in the code like:
message="your message here"
You can make it dynamic, by adding dmx-bind: in front of it:
dmx-bind:message="'your message here'"
(note the single quotes for the static values here!!)
You can use the browser component in the dmx-bind:message to detect the screen size and build an expression that represents your logic with a ternary operator: