I am encoding a PDF as base64 and sending a post request via cURL
. When I encode a big PDF the post field in cURL
becomes empty. Which configuration in php.ini
I need to tweak in order send huge post payload via cURL?
Asked
Active
Viewed 122 times
-1

Naing Lin Aung
- 3,373
- 4
- 31
- 48

Broshi
- 3,334
- 5
- 37
- 52
-
can you use `$data = file_get_contents('php://input')` instead of `$data = $_POST`. I think $_POST only takes `application/x-www-form-urlencoded` data type (I am not sure. it's worth a try) – Peshraw H. Ahmed Jun 05 '19 at 21:51
-
Thats what I did...still empty. but if I encode a smaller PDF its OK. – Broshi Jun 05 '19 at 21:55
-
in php.ini you will find two lines; can you change the values for `upload_max_filesize` and `post_max_size` – Peshraw H. Ahmed Jun 05 '19 at 21:57
-
upload_max_filesize = 2000M, post_max_size = 0 (disabled).. – Broshi Jun 05 '19 at 22:07
1 Answers
1
As mentioned by Peshraw H. Ahmed on his second comment,upload_max_filesize
and post_max_size
is the parameter that would do the work. But if you're file is really big (say 20 Mb) and your php is allowed to use maximum 16MB, then it might fail too. So in that case, also check memory_limit
parameter and set it higher.
However, as you're trying to send file using Curl, also check this answer to use curl infile option.

Tuhin
- 195
- 1
- 9