Restore value for nested fields when validation failed

i have multiple association of images. If user select one invalid image and save form all files are removed. How rebuild it on form?

Temporary files created by Plug.Upload are cleaned up after the request is handled. You can copy them somewhere before sending a response from your controller action maybe?

The last time I created a form with multiple uploads I fired off an “upload” xhr request every time the user added anything. That made the form submission a bit quicker than if it were to upload all the files at once when the is finally submitted. Also a better UX probably in terms of errors since they were shown almost immediately after the file was selected.

1 Like