Reset live_file_input after file has been uploaded

The issue is opened here:

I think this line is not being called upon successful upload - I couldn’t find any reference for usage, could be dynamic, didn’t debug throughly.

Or browser implementation changed, the suggestion is to set the value to empty, but HTML input won’t take even test values.

While its display value still chicken.png

I just remembered there is nice cancel upload functionality and wanted to see what’s behind the scenes but then I figured out, the image preview never changes with that demo.

I followed through the chain and didn’t spot clearFiles. Not sure who would call to clear.

Aha! This issue is a little different than I thought it was, and the difference was further obfuscated by the differences in my examples– this affects any live_file_input when max_entries: 1.

When max_entries: 1, the input value is never cleared. You can modify the Basic Uploads demo to verify.

On the JS side, when input.multiple is true, its value gets reset. We likely need to reset the value when after the form submit too, but I need to dig a bit deeper. Stay tuned! :slight_smile:

5 Likes

We generally try to keep uploads as small as possible as many of our members browse the forum on their commute (large images can eat into their bandwidth). Generally I would recommend small image uploads (but not of text if it can simply by copied and pasted into a post) and for anything larger than the forum limits, uploaded to somewhere like a GH gist and then simply post the link to it on the forum :smiley:

1 Like