angular-file-input

Simple angularjs directive to handle the File Reader API.
2 people use it
Author: 2278608?v=3 Goldark
Submitted by: 2183506?v=3 odra

Angular File Input

Simple angular js directive to handle the File Reader API.

Usage

Check the demo folder (demo/index.html) for examples.

Installation

Module dependency

Files to be used in production are located in the folder "angular-file-input/dist"

Including the required files (js and css)

Docs

The directive supports two parameters:

  • mode: the file reader mode to be used;
  • callback: a callback function with the file object

Available mode options:

  • data-url: read file content as data url
  • array-buffer: read file content as data buffer
  • binary-string: read file content as a binary string
  • text: read file content as text/plain

If you do not provide a mode, it will assume "data-url" as default.

The File object response

The file object used in the callback function will have the following properties:

  • name
  • size
  • content
  • mimetype
  • encoding (only available in "data-url" mode)

Samples

License

Angular File Input is licensed under MIT License.

comments powered by Disqus
This page was last updated over 2 years ago.