나는 파일을 서버에 업로드하기 위해 angularjs와 ng-file-upload를 사용하고 있습니다. 파일 이름을 가져 와서 서버에 같은 이름으로 저장할 수 있습니다.ng-file-upload에서 업로드 된 파일의 파일 이름을 얻는 방법
업로드 후 "파일 선택"버튼 근처에 파일 이름이 표시되지만 파일과 함께 파일 이름을 파일에 전달할 수 있도록 파일 이름을 범위 변수로 설정하려고합니다.
업로드 코드 :
Upload.upload({
url: $scope.ipForHttp+"addVehicles?ClassificationID=" + $scope.C.ClassificationID + "&ClassName=" +
$scope.C.ClassName + "&ClassRate=" + $scope.C.ClassRate + "&ClassImage="+$scope.file+"&ClientID=1",
data:{file:$scope.file}
})
있는 HTML이 :
<input type="file" ngf-select ng-model="file" name="file"
ngf-pattern="'image/*'"accept="image/*" ngf-max-size="20MB" />
감사합니다,이 작품은 나를 위해 !!! –