I am using angularjs and the ng-file-upload to upload a file to a server. I want to get the file name so that I can save it with the same name in the server.
After uploading I see the file name near the "choose file" button, but I want to set the file name to a scope variable so that I can pass the file name to server along with the file.
The upload code:
url: $scope.ipForHttp+"addVehicles?ClassificationID=" + $scope.C.ClassificationID + "&ClassName=" +
$scope.C.ClassName + "&ClassRate=" + $scope.C.ClassRate + "&ClassImage="+$scope.file+"&ClientID=1",
<input type="file" ngf-select ng-model="file" name="file"
ngf-pattern="'image/*'"accept="image/*" ngf-max-size="20MB" />
You can access like this,
$scope.filename = $scope.file.name;