p-fileUpload: Specify "Accept" File Types is particular about spacing...

UI Components for Angular
Post Reply
Primaryw
Posts: 26
Joined: 09 Nov 2017, 17:51

16 Nov 2017, 21:51

Just something I noted while working with this module...

The P-fileUpload attribute "accept" will take multiple entries, but any spaces between them will cause failures.

Example: FAILS due to extra white-space after the commas in the values for "accept"

Code: Select all

<p-fileUpload 
name="myfile[]" 
accept=".csv, .xml, .tsv" 
showUploadButton="false" 
showCancelButton="false" 
url="./upload.php"></p-fileUpload>
Example: Works!! Whitespace removed.

Code: Select all

<p-fileUpload 
name="myfile[]" 
accept=".csv,.xml,.tsv" 
showUploadButton="false" 
showCancelButton="false" 
url="./upload.php"></p-fileUpload>
Hope this helps someone.

Mc128k
Posts: 10
Joined: 08 Jan 2018, 00:21

03 Jul 2018, 14:16

Yes, that helped, and it should REALLY be written in the docs.

PrimaryUser
Posts: 2
Joined: 29 Mar 2019, 15:02

01 Sep 2020, 17:59

Thanks, very helpful!
This should really be in the docs, the only thing which is there is: "To filter files in native file browser dialog.". Not telling anything about the required format.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests