HTML5 File Upload Support Product Page

Clearing preview and file field

Asked 19 Nov 2015 23:06:48
have this question
19 Nov 2015 23:06:48 Brad Lawryk posted:
Is there a way to clear the preview and file field on successful upload? Also to add a responsive notify when upload is successful?


Replied 31 May 2016 09:57:52
31 May 2016 09:57:52 Herve de Brabandère 7ok sprl replied:
To clear all fields including file field add this javascrit on successful upload document.forms['form_name'].reset() .
Regarding clearing preview i'm also looking for a way to do that.
Replied 31 May 2016 14:17:00
31 May 2016 14:17:00 Teodor Kuduschiev replied:
Due to security reasons, the manipulation of file content is not allowed. could you tell me if you are using the Bootstrap 3 Forms designer in order to setup your file field, or are you using a regular file field?
Replied 31 May 2016 15:03:56
31 May 2016 15:03:56 Herve de Brabandère 7ok sprl replied:
Hello Teodor,
I'm using Bootstrap 3 Forms designer (nice tool) in order to setup my file field.
I don't want to manipulate file content.
I have a single page.
In the upper part i have a form with just the file field, a multiple pictures preview and a submit button.
In the lower part i have a already loaded pictures gallery.
When i submit the form i don't want to reload the page, i just use a behavier to refresh pictures list.
Then in the lower part i see all pictures including just loaded images, that's ok.
But in the upper part names of the already uploaded files are always displayed in the fiel field; to clean those names a use a javascrit on successful upload behavior : document.forms['form_name'].reset() . This do the job.
On the other hand just uploaded images previews are always diplayed under the empty file field and i don'nt know how to clear this preview.
Replied 01 Jun 2016 15:25:14
01 Jun 2016 15:25:14 Teodor Kuduschiev replied:
Hi Herve,
by "manipulation of file field content" i mean exactly clearing its content.
I will take a deeper look at how to also remove the preview images, when clearing the field content.
Replied 01 Jun 2016 15:38:09
01 Jun 2016 15:38:09 Herve de Brabandère 7ok sprl replied:
Thank you Teodor.
Waiting to read you.
Replied 02 Aug 2016 17:36:38
02 Aug 2016 17:36:38 Baub Eis replied:
Did anyone figure out how to clear the preview image?

Replied 02 Oct 2016 11:13:07
02 Oct 2016 11:13:07 David Woolley replied:
Also needing to clear the preview image on successful upload.
Any workaround yet?
I think the file field must be cleared after upload then there is no dataUrl to show.
Replied 02 Oct 2016 16:48:26
02 Oct 2016 16:48:26 Herve de Brabandère 7ok sprl replied:
Still waiting to read you Teodor
Replied 12 Dec 2016 02:14:48
12 Dec 2016 02:14:48 Ben Pleysier replied:
No need to clear the field, just re-load the images that do work, or if you don't want to upload any images, choose an empty or one pixel image.

Reply to this topic