jhuril123's avatar

Laravel http 500 internal server error when used in mobile phone

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 a 500 internal server error

HTML

    <input type="file" id="photo_input"  onchange="angular.element(this).scope().Get_Client_Photo(this,angular.element(this).scope().$index)"  style="visibility: hidden;">

AngularJS

    $scope.Get_Client_Photo = function(element){
        console.log($scope.Pre_Plan_Call_Day_Details.pre_plan_call_day_id);
        $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);
    }

$scope.Submit_DCR = function(details_of_visit,amount,pre_plan_call_day_id,client_id,pre_plan_call_id){
    $http({
                        method : "POST",
                        url : '/marketing_officer/routes/Submit_DCR',
                        data: {},
                        headers: {},
                        transformRequest: function(data){
                        var formData = new FormData();
                        formData.append("signature",signature);
                        formData.append("photo",photo[0]);
                        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);
                                });
}
0 likes
1 reply

Please or to participate in this conversation.