Predefined files

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

You might want a user to open the dialog and see a predefined file already loaded into the widget. This article explains how to get such behavior.

The value of the [role=uploadcare-uploader] input may either be empty or contain a CDN link with file UUID.

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

Here’s an example of how you set a predefined value,

<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"
-->

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.