Maximum limit of POST

Asked

Viewed 928 times

1

I am trying to make a video upload form but I have a problem that makes it impossible to upload because I always get the following error:

Warning: POST Content-Length of 69509336 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

Even changing php.ini so that the posts have no limits

post_max_size=0

What can I do to solve this problem?

 <form action="" method="POST" enctype="multipart/form-data">
            <input type="file" name="file" />
            <input type="submit"/>
        </form>

        <?php

            $randomNum=substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 0, 11);
            $randomNum64 = base64_encode($randomNum);
            $base64 = base64_encode($randomNum);



           if(isset($_FILES['file'])){
               $errors= array();
               $file_name = $_FILES['file']['name'];
               $file_size =$_FILES['file']['size'];
               $file_tmp =$_FILES['file']['tmp_name'];
               $file_type=$_FILES['file']['type'];
               $file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));


               if(empty($errors)==true){
                   move_uploaded_file($file_tmp,"uploads/".$file_name);
                   echo "Success";
               }else{
                   print_r($errors);
               }
           }

        ?>
  • This is a server limitation, if you go to php.ini and search by post_max_size you can check which limit size you have to pass data through POST.

  • I am using the local XAMPP server, the code I put from PHP ini was what I put in my file

2 answers

1

This is a server limitation, if you go to php.ini and search by post_max_size you can check which limit size you have to pass data through POST.

inserir a descrição da imagem aqui

You can access this information via browser.

Create a php file publish and access it

 <?php

   phpinfo(); 

 ?>

Made the change, restart the server to take effect.

a tip that might be useful: Em alguns casos, você precisará aumentar o tempo máximo de execução.

  • I’ve already changed this option in my php ini

  • 1

    @Luhansalimena, I never touched php.ini but it seems that you have to restart the server for the change to take effect, You did this?

  • The friend up there helped me on this, I hadn’t restarted the server so the change wasn’t working

  • @Luhansalimena the friend upstairs has been cheating, my answer is older hahaha :) beyond my comment which is older still

  • @Luhansalimena, anyway will a tip that may be useful some day. Em alguns casos, você precisará aumentar o tempo máximo de execução.

1


It is not a good practice to leave unlimited, especially if it is open, maaaaas... Try this:

  post_max_size = 2M para
  post_max_size 100M
  upload_max_filesize = 8M para
  upload_max_filesize = 100M
  • I know it’s not good practice, but I put it to the test since no option was working. I updated the data to the ones you provided and keep getting the same error

  • I went through it this week and had to change both variables, don’t forget to restart the php server to take effect. Do a phpinfo(), I know you’ve done to check the change.

  • I restarted and now it worked, thank you very much :D

  • I had the same problem with uploading tmb videos, I spent the day worrying about not restarting the damned ... rs, living, learning and sharing.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.