Guvaliour
Guvaliour

Reputation: 417

How to get file extension in Angular2

My Requirement is to upload only files that ends with.pdf extension in Angular 2 is there any method to find the extension or like any split method in java.

Upvotes: 4

Views: 22249

Answers (1)

Ali Ahmad Pasa
Ali Ahmad Pasa

Reputation: 156

you can use split with pop for the file extension :

$(this).fileName.split('.').pop(); 

Upvotes: 12

Related Questions