Search code examples
angularangular-materialmaterial-design

How to use input type file in angular material


How to use input type file in angular material

Hi, I am using angular material for designing. when i go on angular material site there no input type file element. anyone know about this.


Solution

  • Angular Material does not support yet a workaround for file upload. There are alternative to archieve this. e.g using external libraries.

    angular-material-fileupload: link to npm package

    Supported features:

    • Drag and drop
    • common uploads
    • progress bar
    • file size and more...

    ngx-material-file-input: Link to repository

    Supported features:

    • ngx-mat-file-input component, to use inside Angular Material mat-form-field
    • a FileValidator with maxContentSize, to limit the file size
    • a ByteFormatPipe to format the file size in a human-readable format
    • and more small minor features...

    Update

    See the answer here if you just need a workaround without external library https://stackoverflow.com/a/53546417/6432698