jhuril123's avatar

Laravel http 500 internal server error when used in mobile phone Ask

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 Code

Angular JS

$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);
                            });
0 likes
1 reply
mubashirali's avatar

Inside you contorller method put this as very first line of your method.

ini_set('memory_limit','256M'); $file_name = $request->file('myImage');

Please or to participate in this conversation.