radify/angular-file

Name: angular-file

Owner: Radify

Description: Native file upload handling for AngularJS

Created: 2013-02-20 16:59:35.0

Updated: 2018-01-19 10:21:19.0

Pushed: 2015-08-20 18:58:45.0

Homepage: null

Size: 185

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ur.file: Native HTML5-based file input bindings for AngularJS
Example
l ng-app="myApp">
d>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular-resource.min.js"></script>
<script src="angular-file.js"></script>
<script>
    var app = angular.module('myApp', ['ur.file', 'ngResource']);

    app.controller('FileController', function($scope, $resource) {

        var Files = $resource('/files/:id', { id: "@id" });

        angular.extend($scope, {

            model: { file: null },

            upload: function(model) {
                Files.prototype.$save.call(model.file, function(self, headers) {
                    // Handle server response
                });
            }
        });
    });
</script>
ad>
y ng-controller="FileController">
<input type="file" ng-model="model.file" change="upload(model)" />
dy>
ml>
What's happening here?

The X-File-Name header is encoded with URL encoding.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.