reset fileinput | сбросить fileinput - Forum

Forum Navigation
You need to log in to create posts and topics.

reset fileinput | сбросить fileinput

How can I reset fileinput ?
I tried resetting the fileinput variable, but to no avail.
I tried deleting the selected zip file from memory, but that didn't help either.

Как можно сбросить fileinput ?
Я пытался сбрасывать переменную fileinput, но без результатно.
Я пробовал удалять из памяти выбранный zip файл, но и это не помогло.

Uploaded files:
  • You need to login to have access to uploads.

In VisualNEO Web, when working with a FileInput object, the onchange event doesn't trigger again if the user selects the same file twice in a row. This is standard browser behavior for HTML file inputs.

To allow re-selecting the same file, you need to reset the file input field. Unfortunately, simply resetting a variable bound to it won't work because the file selection resides in the DOM element, not in the NeoScript variable.

Solution:

BeginJS
  $("#f1").val = "";
EndJS

Where f1 is the property-name you have assigned to the FileInput object.
If you want to reset immediately after a file is selected (so it can be chosen again), append the above code to the end of the onchange handler

@luishp
не получилось
it didn't work out

Uploaded files:
  • You need to login to have access to uploads.

@luishp

Вот так работает  |  This is how it works

BeginJS
document.getElementById('projectLoadZip').value = '';
EndJS

 

@lolo both work as they do exactly the same.
Please check the attached sample.

Uploaded files:
  • You need to login to have access to uploads.

@luishp
Не работает, может это связано с  браузером или операционной системой?
It doesn't work, maybe it's related to the browser or operating system?

Uploaded files:
  • You need to login to have access to uploads.

@lolo interesting and really strange. It works for me on every web browser.
In any case I'm glad you have found an alternative that works :)