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

php script not excuted #2015

Open laellou opened 6 years ago

laellou commented 6 years ago

Hi, I don't understand why my script is not called, I made some test and this file is not executed, everything is ok in the front, but my file is not uploaded

here is my code :

$scope.uploadFiles = function(file, errFiles) { $scope.f = file; $scope.errFile = errFiles && errFiles[0]; if (file) { file.upload = Upload.upload({ url: myurl, data: {file: file} });

        file.upload.then(function (response) {
            $timeout(function () {
                file.result = response.data;
            });
        }, function (response) {
            if (response.status > 0)
                $scope.errorMsg = response.status + ': ' + response.data;
        }, function (evt) {
            file.progress = Math.min(100, parseInt(100.0 * 
                                     evt.loaded / evt.total));
        });
    }
}

front:

Upload on file select

<input type="file" ngf-select="uploadFiles($file, $invalidFiles)" accept="video/*" ngf-max-size="80MB"> Select File

File:

{{f.name}} {{errFile.name}} {{errFile.$error}} {{errFile.$errorParam}}
  </span>


{{errorMsg}}

Like in the example, Waht am I doing wrong ?

Thanks