0

So, I have this Ajax script with a PHP script in which I upload photos to the server.

This is the Ajax:

$.ajax(
{
    type: "POST",
    url: "formImage.php",
    dataType:"json",
    xhr: function()
    {
        var myXhr = $.ajaxSettings.xhr();
        if(myXhr.upload)
        {
            myXhr.upload.addEventListener('progress',progress, false);
        }
        return myXhr;
    },
    data: {info: info },
    beforeSend : function ()
    {
        //
    },
    contentType: "application/x-www-form-urlencoded;charset=UTF-8", success: function(result)
    {
    }
});

I send an array to a PHP script, when I echo out the result on the PHP script, on the console log I get POST Content-Length exceeded, what I am doing is I grab multiple base64 image code and concatenate it into a string but separate them with "-" which I store in info[0]. I tried sending a photo at a time to the PHP script and it works, but that is really inefficient because if I have let's say 300 photos loaded, I can't do an Ajax request for each of them, I want to grab the whole 300 photos base64 code and send it as one string. Can anyone help me ?

2
  • Have you tried by splitting the string to make 3 or 4 requests instead? It might be acceptable to do a bit more than 1 request no? Commented Jan 13, 2014 at 10:39
  • I haven't, but I would like to have just one request to the server, but if it can't be done, I guess I can do that method. Commented Jan 13, 2014 at 10:40

2 Answers 2

1

You need to set post_max_size value in PHP configuration. By default, it allows 8 MB

Sign up to request clarification or add additional context in comments.

Comments

0

Check the server settings in php.ini

memory_limit = ?
upload_max_filesize = ?
post_max_size = ?

Change Accordingly and restart the server and see

http://hakre.wordpress.com/2011/06/09/protocol-of-some-php-memory-stretching-fun/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.