• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 941
  • Last Modified:

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.
0
young_buddha
Asked:
young_buddha
  • 3
  • 2
  • 2
  • +1
3 Solutions
 
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
0
 
twilexCommented:
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"

Brgs,
Kim
0
 
twilexCommented:
Forgot.. depending on implementation you should also look at "upload_max_filesize" option. It sets "Maximum allowed size for uploaded files".

Brgs,
Kim
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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:
http://us2.php.net/manual/en/ini.core.php

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
0
 
dazweejaCommented:
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:

<?php
phpinfo();
?>

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
</IfModule>
0
 
flashmexCommented:
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.
0
 
dazweejaCommented:
@ 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.
0
 
dazweejaCommented:
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now