Base64 Max Accepted Length?

Hey Guys,

What is the max length string I can send in a $_POST API Call?

I have a Base64 string (Image Data) I am trying to send / do some conversions from Base64 >> Image and save the file.

My problem is that only half of the image is displaying and by looking at the Returned value, the Base64 is getting cut in half (losing a bunch of characters after).

I believe the POST may have a limit (or string) and am trying to figure out how to increase this or a work around.


Can you share your API Action window? I want to see how you’re filling the parameters

Looking at the web, the string length limit may be around the order of 200 MB at least. Certainly, you’re not exceeding that, leading to the conclusion this may be specific to Wappler

Regarding $_POST, the HTTP protocol does not specify a limit

Ok so we are deff not exceeding that…

Here is the custom function (very basic).

It works correctly if I hard code the value in for “data” which is the base64 value…

const fs = require('fs');
const sharp = require("sharp");
const { toSystemPath } = require('../../../lib/core/path');

exports.getValue = function (options) {
    let path = toSystemPath(this.parseRequired(this.parse(options.path), 'string', 'fs.exists: path is required.'))


    let data = this.parse(options.base64);
    let buffer = Buffer.from(data, 'base64');
    let imgname = this.parse(options.imgname);

    fs.writeFile('public/user_design_images/' + imgname + '.png', data, 'base64', function (err) {
        console.log("Done Success")


Then here is a screenshot of the API Call. It is just a form call with a string

If I do a “Set Value” of the $_POST “blob” which is the base64 value, it gets cut short and loses about half of the characters.

To me seems like a Wappler issue / question but I am not sure?

About the Set Value:

The maximum length of JSON strings. The default is 2097152 characters , which is equivalent to 4 MB of Unicode string data.

How much size is your image?

The image is 1.4mb for this example

The code produces the same result even if just using the $_POST.blob data so I am not sure on this if it’s causing issues or not but would appear not to be the issue from what your saying with 4MB limit.

Current goal: Figure out at what step the string is being cut


Ok so both results are returning 22…

I am playing around a bit to see if I am missing anything but any other thoughts?

22? Of the Base64-encoded image?
That’s not even half :frowning:

Don’t have any other ideas for today

Yeah my thoughts as well. Going to sleep on it!

Thanks for the help so far!

@Teodor @patrick Any ideas on this?

You don’t mention what server technology you are using, guessing node however generally the max post size can be set at server level.
In PHP the value can be set in php.ini like this


I believe it may also work from your .htaccess file with

php_value post_max_size 512M 

Not sure if this will help but worth a try

For node i think it is more complex needing middleware (google “body-parser”?)
This post may also help

The maximum post size depends on the web server configuration, but when you exceed it you would normally get an http error and not get half of the data. Not sure if the JSON parser has some limit, I don’t think it has.

First thing is to check if the options.base64 parameter is correct or that it indeed contains only partial the submitted data.

See both Base64 examples attached.

sent_base64 = The actual base we have sent

received_base64 = What the raw $POST ends up showing, It cuts the file size in half

As mentioned, the file we are sending is about 1.8MB so should be within the limits.

This is on LOCALHOST / Node.js

Archive (2.1 MB)

Do you know in which format the data is being send, can be as application/x-www-form-urlencoded, multipart/form-data or application/json. Depending on the content-type it is differently parsed on the server. For example multipart/form-data also supports binary file uploads.

The urlencoded and json are parsed using the body-parser middleware in express. Default limit seems to be 100KB here.

expressjs/body-parser: Node.js body parsing middleware (

The multipart/form-data is being parsed by the express-fileupload middleware. That seems to use Busboy where you can set different limits. In their documentation I see the max field value size is 1MB. This seems to match exactly with your cut-off data.

richardgirges/express-fileupload: Simple express file upload middleware that wraps around busboy (

mscdex/busboy: A streaming parser for HTML form data for node.js (


Create a new file app/config/user_config.json with the following content:

  "fileupload": {
    "limits": {
      "fieldSize": 10000000
1 Like

This did it patrick thank you so much for the help!

For your question and if others are reading, we are sending as multipart currently (tested a few others)

You can mark this as the solution!