Error loading really big file in PHP?

I have a PHP form for uploading files, and it works fine and displays an error message if something went wrong. This is all good.

The problem is that when I test with a really large file, it just refreshes the page, as if I hadn’t sent the file at all, and not one of the $ _POST variables from the form was even sent to the server.

I want to show the user an error by telling them that the file is too large. However, I cannot do this.

Does anyone know what is going on?

+3
source share
6 answers

Check your PHP ini file, which determines how large the PHP file will allow to load. These variables are important:

  • max upload filesize (upload_max_filesize)
  • (post_max_size)
  • (memory_limit)

, .

: http://ca3.php.net/manual/en/features.file-upload.common-pitfalls.php

EDIT: , 2 . , : http://www.motobit.com/help/scptutl/pa98.htm. - ?

, , Apache: http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestbody

, , , , -, ( firefox) , print_r($_FILES) . , firebug. , , , ( ). , , PHP .

+13

$_POST , post_max_size:

PHP :

post_max_size, $_POST $_FILES . -, $_GET script , .. <form action="edit.php?processed=1"> , $_GET [''] .

+6

, . , , , , . , 2 php, php.ini. "upload_max_filesize" . POST, HTTP POST-. "post_max_size" .

+1

max upload filesize (upload_max_filesize) (post_max_size) , . , .., , .

0

, :

max upload filesize (upload_max_filesize)
max post data size (post_max_size)
memory limit (memory_limit)

, , , script.

max_execution_time
0
source

Source: https://habr.com/ru/post/1704281/


All Articles