Maximum limit on POST data sent from Flash to php script

I was wondering (although i am not facing any such problem), what is the max. size limit on the POST data sent from flash(or html form) . I am sending successfully around 1 MB xml file as a POST variable using flash actionscript.

Also one more question that comes to mind. If i refresh the page while the POST data is still being sent to the php script (i am saving this data which is contained in a POST variable into a .xml file on server) what will happen ? Will the php script contend with the partially sent data  and continue with its processing ?

I was trying this continuously and i think on one occasion i managed to corrupt the xml file on the server...I will test some more but i just wish to get an understanding on how POST data is sent from HTML/Flash and how it is used in PHP.
Who is Participating?
Hava a look at the "post_max_size" setting in php.ini
It will signify the "Maximum size of POST data that PHP will accept"

Ray PaseurCommented:
I'm not aware of any limit on the size of POST - I suppose if there is such a thing it would be dependent on the server.  As far as the question of "while the post data is being sent" I would guess you are speaking of a script-to-script post using fsockopen() to write the data?  Other than that, I cannot think of any condition where you might find an incomplete post array being presented to a script.  It is one of those things like $_COOKIE that should be present and complete in the environment before the script obtains control.

Best, ~Ray
Forgot.. depending on implementation you should also look at "upload_max_filesize" option. It sets "Maximum allowed size for uploaded files".

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Ray PaseurCommented:
Hmm... "post_max_size" setting in php.ini"

That may be settable (I know that upload size is settable at run time).
Search the man page here for "post_max_size" to see more:

Looks like the limit is somewhere around the 32-bit unsigned integer.  Note this piece of the man page: "If the size of post data is greater than post_max_size, the $_POST and $_FILES  superglobals  are empty."

HTH, ~Ray
The default on most PHP installations is 2M. You can check for post_max_size looking in your php.ini or by creating a PHP file with just:


If it's too low, you can change these values in your php.ini (in these examples to 5MB):

upload_max_filesize = 5M
post_max_size = 5M

Or this in your code (if your PHP config allows it):

ini_set('post_max_size', '5M');
ini_set('upload_max_filesize', '5M');

Or this in a file named .htaccess in the root directory of the relevant site (if AllowOverride is set to All or Options for that directory in your Apache config):

<IfModule mod_php5.c>
  php_value upload_max_filesize   5M
  php_value post_max_size   5M
acutally the change in the ini will solve the issue but it is not a good idea. instead of that you can use a javascript funtion in a page and form that page ajax the post in that way you dont have to worry about he post limit.
@ flashmex, there's a number of things I don't understand about your comment:

1. The OP is using both Flash and HTML so it doesn't make sense to recommend an AJAX upload system with Flash. Flash already has superior upload functionality built-in through the FileReference API.

2. AJAX upload systems still send the data from the client to the server through a HTTP POST so the same PHP POST restrictions apply if the server-side language used is PHP. In the AJAX upload systems I've seen all the AJAX does is initiate the submit and provide a pretty progress bar. Can you show me an example where the PHP POST restriction doesn't apply?

3. Both the ini_set and htaccess method set the POST limit on a per-script basis so if this is available, I don't see why the OP shouldn't use this method.
I should clarify that the htaccess method will only set the POST limit on a per-script basis if you put your PHP upload script in it's own directory. The htacess file will reside in this directory too. Obviously, if your htaccess file resides in the root directory of your website, it will effect the PHP values for your entire site (except for subdirectories with their own htaccess files that may override these values for that directory).

Anyway, this method is very easy to test to see if it works on your webserver - create a folder, create a file called .htaccess with the above code and put it in this folder, create a php file containing the phpinfo() command and put it in this folder as well, and finally run the php file and check the results.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.