Hi guys i need help when i am uploading an image file from my desktop the code wont have errors. but when i tried using a mobile phone to upload an image it will have an error here is the error
HTML FILE
<input type="file" id="photo_input" capture="camera" onchange="angular.element(this).scope().Get_Client_Photo(this,angular.element(this).scope().$index)" style="visibility: hidden;">
Angular JS Request
$scope.Get_Client_Photo = function(element){
$scope.client_photo = element.files
$scope.uptfile = element.files
$scope.$apply();
var validCVFiles = ["png","jpeg","jpg",];
var name = $scope.client_photo[0].name;
var fileType = name.substr(name.indexOf(".")+1)
console.log($scope.client_photo);
var reader = new FileReader();
reader.onload = function (element) {
$scope.PreviewImage = element.target.result;
$scope.$apply();
};
reader.readAsDataURL(element.files[0]);
// $("#default_preview").attr('hidden','hidden');
// $("#preview_image").attr('hidden',false);
}
$http({
method : "POST",
url : '/marketing_officer/routes/Submit_DCR',
data: {},
headers: {'Content-Type': undefined},
transformRequest: function(data){
var formData = new FormData();
formData.append("signature",signature);
formData.append("photo",photo);
formData.append("details_of_visit",$scope.details_of_visit);
formData.append("amount",$scope.amount);
formData.append("pre_plan_call_day_id",pre_plan_call_day_id);
formData.append("client_id",client_id);
console.log(formData);
return formData;
},
}).then(function mySuccess(response) {
console.log(response.data);
Swal.fire(
'Submitted!',
'Daily Call Report Successfully Submitted!',
'success'
)
$scope.View_Pre_Plan_Call(pre_plan_call_id);
}, function myError(response) {
console.log(response);
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire