0

I'm writing some tests trying to get the blueimp jquery-fileupload plugin working with angularjs.

Here is what I wrote, trying to keep it as simple as I could :

[controller.js]

app.controller('myAppController', function ($scope, uploadHandlerUrl) {
    $scope.options = {
        url: uploadHandlerUrl,
        add: function(e,data) {
            angular.element('#submit').click(function() {
                data.submit();
            });
        },
        done: function(e, data) {
            console.log('done', data);
        },
        progress: function(e,data) {
            console.log('progressing', data)
        }
    };
});;

[html]

<form id="fileupload" method="POST" enctype="multipart/form-data" data-fileupload="options">
    <input type="file" name="files[]" multiple="">
    <button id="submit">Submit</button>
</form>

You can also see a running instance here.

The problem is, every data object that is returned by the fileupload plugin seems to tell me that eveything went fine, but no files are actually uploaded on the server (the files should be uploaded here).

It may be caused by some configuration issue on my server, but I've absolutely no idea in which direction I should search. I'm using blueimp native uploadHandler.php on the server-side

1 Answer 1

2

This might save you hassle if you are looking for file upload using AngularJS

https://github.com/danialfarid/angular-file-upload

It is basically a directive like tosh's answer that takes care of non-HTML5 browsers with FileAPI flash polyfill and has $http.uploadFile function to upload the actual file via AJAX.

This issue Everything looks to be working, but no file in upload folder seems very similar to yours you can ask him how he fixed it.

Sign up to request clarification or add additional context in comments.

3 Comments

this looks strongly like a solution to my problem, thank you very much, I'll give it a try when I find some time.
Is it cross-browser solution ?
Yes it is. It uses Flash and FileAPI for non-html5 browsers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.