-1

I would like to access this property and hopefully change it, so that my event listener, that listens to the event change, gets invoked on two consecutive uploads of the same file.

gicig
  • 170
  • 1
  • 12
  • 1
    http://stackoverflow.com/questions/13655391/storing-the-image-from-an-html-input-file-form-locally – Akash Agrawal Mar 29 '17 at 12:53
  • So, it is not possible to change this path. I still have to react when the same file is uploaded two times after each other, because it might happen that the file has changed, and I need to get this information. Is there a way to do that? – gicig Mar 29 '17 at 12:55
  • what exactly you want to do? – Akash Agrawal Mar 29 '17 at 13:00
  • I have an event listener registered to `change`. It gets invoked when I upload a file, say `import_file.csv`. If, after some time, I decide to upload the same file, the event listener is not invoked. Because there is no change, I guess. However, the file itself **has changed** and I want my listener to get these changes. – gicig Mar 29 '17 at 13:05
  • 1
    What if the user has two different files with the same name? – Josh Lee Mar 29 '17 at 13:11

1 Answers1

1

Are you looking for something like this?

var $c  = $("#container");
var $f1 = $("#container .f1");

function FChange() {
    alert("f1 changed");
    
    $(this).remove();
    $("<input type='file' class='f1' />").change(FChange).appendTo($c);
}

$f1.change(FChange);
.f1 { z-index: 2 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container">
    <input type="file" class="f1">
</div>
Akash Agrawal
  • 1,759
  • 1
  • 13
  • 31