I am encountering an issue with my simple file upload code. The error message is being displayed as follows:
https://i.sstatic.net/NAPYH.png
Below is the code snippet causing the problem:
<input type="file" name="student_image" onchange="angular.element(this).scope().uploadFile(this.files)" ng-model="formData.studentImage" id="student_image">
$scope.uploadFile = function (files) {
var form_data = new FormData();
form_data.append("file", files[0]);
$http.post('process.php', form_data, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).success(function (data) {
if (data == "failed") {
// if not successful, bind errors to error variables
$scope.errorFinal = "Failed";
} else {
$scope.formData.image_name = data;
}
}).error('failed');
};