Maximum amount of elements sent by a form?

7

I would like to know if there is a maximum amount of elements that I can send from one form to another via POST as well as via GET .

I know that if I pass my data via GET , there is a maximum length of URL , varying according to the browser, but via POST this seems kind of obscure to me ...

A snippet of w3schools :

  

POST requests have no restrictions on data length

Is this an absolute truth? Is there a maximum restriction?

    
asked by anonymous 16.01.2015 / 12:19

4 answers

4

What you should really note is the limit of the weakest, which is the smallest limit between all components involved in the process.

For the URL, even if other components accept a limit greater than 2048 bytes, Internet Explorer can not send more, so you should work with this limit unless you make sure no users are using IE, which is very unlikely. Even so, I would still have that limit to guarantee. For both GET and POST, this is the limit that the URL must have, but with POST it is possible to send data beyond the URL, the GET, it only sends through the URL.

The HTTP protocol does not impose any limit for sending data via POST. But the HTTP server may be set to some limit.

In theory none browser imposes any limits.

PHP usually has a relatively low threshold that works most of the time. Other languages may have some limitations.

Even if you resolve to change this PHP or HTTP server limit, think about this, this can lead to problems. It is not easy to handle large data submissions. Otherwise, sending may have problems in between, so both the server and the client need to know how to handle it. It may be better to split the send if the data to be sent is too large, and obviously needs to manage resends.

So the limit of elements is not what matters. If you already have multiple elements and added up they are very large, it is best to send them separately if possible.

    
16.01.2015 / 12:31
7

There is no limit , but both the language interpreter and the server can restrict it.

For POST in PHP, there is a line in php.ini that determines this.

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

By default it is 8 mega generally, but each hosting treats in a different way, so it's worth paying attention to if there is a need in your project.

However, the server can restrict this as well. For apache , for example, it stays here: LimitRequestBody and LimitRequestFieldSize . On other servers, the settings vary.

    
16.01.2015 / 12:24
5

Technically there is a packet constraint sent to execute a request.

The network is divided into layers, listed below:

  • Application Layer
  • Transport Layer
  • Network Layer
  • Link layer
  • Physical Layer
  • While at the application layer there are no limits on the amount of information sent, it does not stop it being fragmented to be sent over the internet.

    In short: no there is a data limit to be sent, but there is a data limit to be sent per packet to respond to your request. And this is done automatically by the machines that are in charge of sending the requisition, like routers and modems.

        
    16.01.2015 / 12:26
    3

    POST has no data limit to send. However, your server may have configured a data limit that you can receive via POST. For example, in PHP the default limit is 2Mb.

        
    16.01.2015 / 12:26