Uploading again in IE fails
When pressing upload button it works the first time, but it will not upload the second time :(
When moving the file input into the hidden form and back. the input's change event get's removed. To fix this we need to clone the input's events.
This isn't possible using jqLite, but I've submitted a pull request to angular, that will enable this.
https://github.com/angular/angular.js/pull/5141
If it gets merged, we can simply clone the element and it's events and it will fix this problem.
Any update on this? :)
Update: or could you guide me on how to fix this issue by adding jquery as a dependency (jquery is in our project anyway)...
@peeterslaurens was a while since I looked at this but. If I remember correctly, by adding jQuery it clones the element correctly and it just works.
If you cant get it working even though you have jQuery, post a comment and I'll have a look
Jquery is in the project, yet it still does not work. I can 'mimic' the issue in chrome simply by setting the force-iframe-upload to true right?
Edit: Actually i can see it posting the request again, yet image i selected in the first iteration gets uploaded again and again :).
Edit 2: I can see the original element getting copied, but with every new upload, it's that same original element with the file I selected in the first iteration that's getting processed and uploaded. The other elements (for the 2nd, 3rd file-upload iteration) have no functionality :).
So.. I fixed this bug, and it works in all browsers, by just removing the scope.$apply(function ...) and just calling scope.onUpload({ files: fileInput[0].files }); directly.
Why do we need the .$apply?
I'm experiencing the same issue, but calling scope.onUpload does not fix it for me. Neither in ie9 nor in Chrome latest.
-scope.$apply(function () {
- scope.onUpload({ files: fileInput[0].files });
-});
+scope.onUpload({ files: fileInput[0].files });
@Izzmo is this the diff you're using to fix it?
oh, also, this would not apply to browser that don't use the file api such as IE 9
@fantapop yep, and it's been working for me.
by the way, I worked around this issue but adding an ng-if outside the element with the uploader on it cycling it false and then true again. This full resets the element. It works well.
Example?