AC2 dropzone does not have file.dataUrl

Wappler Version : 6.1.1 beta
Operating System :
Server Model:
Database Type:
Hosting Type:

Expected behavior

Upon selecting a file using the dropzone component, the file.dataUrl property should be set.

Actual behavior

file.dataUrl is null

How to reproduce

Use a dmx-dropzone component and select a file

<input is="dmx-dropzone" id="file_hero" type="file" name="file_hero" message="" accept=".png, .jpg, .jpeg" thumbs="false"  dmx-on:click="hero_image_deleted.uncheck()">

Screenshot 2024-02-20 at 5.17.16 PM

Actually this is a new feature :slight_smile:

Because calculating a dataurl is a very heavy and memory intensive operation, we do it now fully on demand! So only if you have an active binding to it - then it will be calculated.

1 Like

Then it doesn’t appear to be working?

For example this img does not render once the file input has been selected.

 <img dmx-bind:src="file_hero.file.dataUrl||get_sales_page.data.sales_page.hero_image_url" class="sales_page_image">

Could you just try a single data binding expression to it?

Sorry, no change

Ok @patrick will check it out tomorrow.

In general we are moving with ac2 more in the direction of optimized data bindings, so we calculated more things on demand only if they are really used to offer the best performance.

1 Like

Please check if this update fixes it: dmxDropzone.zip (7.2 KB)

Thanks Patrick, that works for dataUrl.

Now when I try to reset, I receive this error

Screenshot 2024-02-23 at 7.05.13 AM

<button id="btn_hero_delete" class="btn btn-primary" style="position: absolute; top: 1.25rem; left: 1.25rem;" dmx-on:click="file_hero.reset();hero_image_deleted.check()">

I also tried file_hero.remove() but similar result.

What is the difference with reset and remove methods?

The reset removes all files and resets to the defaultValue. The remove is just removing a single file.

The error is that it tries to remove the thumbnail which wasn’t created in your case, should be fixed in the following update.

dmxDropzone.zip (7.3 KB)

That takes care of it!

Fixed in Wappler 6.3.1

This topic was automatically closed after 45 hours. New replies are no longer allowed.