danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

add some data to with upload image #2067

Open tputraa opened 6 years ago

tputraa commented 6 years ago

i try to create upload image with additional data. angular + with codeigniter as api

heres my code.

$scope.upload = function (docters) { Upload.upload({ url: wurl + 'docter/save', data: { "spesialis_id": $scope.docters.spesialis_id, "nama_dokter": $scope.docters.nama_dokter, "email": $scope.docters.email, "phone_number": $scope.docters.phone_number, file: $scope.file, token:token } }).success(function (data) { toaster.pop(data.error_type, data.error_title, data.error_msg, 5000, 'trustedHtml'); }); };

this is ng-click :

$scope.saveDocters = function(docters){

        docters.spesialis_id = docters.specialis.id;

        docters.file = $scope.file;
        docters.token = token;

        $scope.upload(docters);

    };

the data not sending to $_post on backend, but the data appear in console google chrome. Help me