uploadcaredocs

Default Files in Widget Dialog

  • This documentation is for the version 3.6.2 of the widget. If you’re looking for the widget v2 docs, check here.

Uploadcare Widget allows you to make specified files appear in the widget dialog on open. This article explains how to implement the behavior.

Specifying files that appear on widget dialog open is implemented by adding the value attribute to your widget <input> element. The attribute may either be empty or hold a file CDN URL or UUID.

If you set the value externally and trigger the DOM change event, it affects the widget. For instance, setting it to a file UUID or a CDN URL will result in that file loaded into the widget. You can do this for a live widget or even before it loads.

Here’s how you do it,

<input type="hidden" role="uploadcare-uploader" name="my_file"
  data-public-key="1c86ca998ba22e75fbc6"
  value="https://ucarecdn.com/9dd2f080-cc52-442d-aa06-1d9eec7f40d1/"
/>

<!--
  Also valid:
  value="9dd2f080-cc52-442d-aa06-1d9eec7f40d1"
-->

You may also want to check out a live example,

We’re always happy to help with code, integration, and other stuff. Search our site for more info or post your question in our Community Area.