I've been looking over this problem for the past 3 hours now and I'm extremely confused. The apache2 error logs say that the php script is being run, however I'm getting a an error from my factory when it's called.
TypeError: InputUpload.uploadImage(...) is undefined
I don't see how the javascript even gets that far to run the php script when the firefox debugger says it isn't defined...
var app = angular.module("app", ["ui.bootstrap"]);
//http://stackoverflow.com/questions/18571001/file-upload-using-angularjs
app.factory("API", function ($http) {
    return {
    uploadImage: function (image) {
        $http.post('/js/upload_image.php', image);
    }
    }
});
app.controller("MainController", ['$scope', '$http', 'API', function($scope, $http, 'API') {
    $scope.imageUrl = "";
    $scope.template = "";
    $scope.templates = [];
    $scope.templates.push("select an option...");
    $scope.templates.push("MakeGray");
    $scope.templates.push("Canny");
    $scope.template = $scope.templates[0];
    $scope.add = function() {
    alert("HELLO");
    var f = document.getElementById('file').files[0];
    var r = new FileReader();
    r.onloadend = function(e) {
        var data = e.target.result;
        API.uploadImage(data)
        .success(function (imgUrl) {
            $scope.imageUrl = imgUrl;
        })
        .error (function (error) {
        });
    }
    r.readAsBinaryString(f);
    }
});