Primeng: File upload onSelect returns no file

Created on 25 Apr 2018  路  9Comments  路  Source: primefaces/primeng

I'm submitting a ...

[x] bug report

Current behavior
Selecting a file on the file-upload module doesn't return any file.

event.files is empty.
originalEvent target files is also empty

Expected behavior
Have a list of selected files within onSelect event.

Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/prime-fileupload-bug-select-event?file=app%2Fapp.component.ts

  • PrimeNG version: 5.2.4
  • Browser: all

All 9 comments

You do have the file information. However you have to directly access the file, analogue in the uploader handler or event.files[0] in this case.

screen shot 2018-04-26 at 08 54 58

Ok. sounds weird though since files appears as empt FileList on event.

@blackholegalaxy I encountered the same issue.
I'd like to do something after user select one file. However, onSelect callback returns nothing for me.

How do you deal with it? Do you have any other alternatives?

The fact is the files are not displayed on console but can be used in the code. event.files is an actual file array... Weird console problem. So i used event.files as expected.

I have same problem, it worked well in the previous version (5.2.0), but not working now (version 5.2.7).

I also have the same issue

same issue here

+1 why not fixing?

The reason you're seeing zero-length FileList is because they are clearing input element after doing work. The clearInputElement method is called (and one more IE-specific) right at the end of selecting the file - that's why you see nothing in console (because it's evaluated at the time you're looking at the console). If you catch onSelect event and do some work on files there, all will be OK. But it's still strange thing that input field is cleared.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

just-paja picture just-paja  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

lilling picture lilling  路  3Comments

garethlewis picture garethlewis  路  3Comments