How to feed uppy dashboard with information on already uploaded file?

Hi,
It has been wonderful. It took me some time to get uppy working, but everybody on the team loves it.

Now question I can not find the answer. I have a form with title and image. Image is direct upload on s3 and is stored as

<input value="{&quot;id&quot;:&quot;34b68d1b33a1d1503c1c908c48e223de.py&quot;,&quot;storage&quot;:&quot;cache&quot;,&quot;metadata&quot;:{&quot;size&quot;:1735,&quot;filename&quot;:&quot;hello_france (1).py&quot;,&quot;mime_type&quot;:&quot;text/x-python&quot;}}" class="uppy-upload-data" type="hidden" name="material[source]" id="material_source">

in the form. But the form is not valid when the title is less than 3 symbols. Check is made on the server so the server returns the error. So I have to feed uppy dashboard again with information about the uploaded file as it is already uploaded.

Do you know how could I do this?

I am not sure if I fully understand your question, but I think I have an idea of what you’re getting at.

This is not an optimal solution, but it should work. Upon a file upload, (to Uppy not to the sever), you could save the file as a variable using the uppy.getFile method and then if the upload fails, you could load the file from the variable using uppy.addFile. Note that you could also store the value in localStorage if you’d need to access it at a later point

Alternatively, you could listen for the upload-error event and take that file parameter and re-add it

Here’s a code snippet of the latter

uppy.on('upload-error', (file, error) => {
  uppy.info(error)
  uppy.addFile(file)
})

Note: I haven’t tested this fully, so I don’t know how well this will work, but it’s worth a shot

- Andrew