Vinod Jadhav
Vinod Jadhav

Reputation: 1065

Post request getting null at server side?

I have written PHP web service using Laravel framework to upload images using base64 string. it is working fine for small base64 string. but when I tried to generate base64 string of 5 MB image then it is getting NULL requst at server side. here is the PHP server side code:

<?php
  $post_data = file_get_contents("php://input");

  $post_data = json_decode($post_data);
  var_dump($post_data);exit;
 ?>

Useing above source code when I tried to print small base 64 request then it is working fine. When I tried to post large base64 image it is returning NULL.

Please help where I am going wrong. Also please suggest is there any other way to upload large base 64 string at server side.

Also I have tried to edit php.ini at "/Applications/MAMP/bin/php/php7.0.12/conf/php.ini" with the following value

post_max_size 200M
upload_max_filesize 200M

and tried to restart sever but still the same error occurs.

Upvotes: 2

Views: 520

Answers (1)

Alex Howansky
Alex Howansky

Reputation: 53636

You're probably hitting a PHP limit. Check your php.ini file for the post_max_size and upload_max_filesize settings.

post_max_size = 8M
upload_max_filesize = 2M

If you change these values, you'll need to restart PHP.

Upvotes: 3

Related Questions