petervandijck's avatar

Nova + Herd: "content too large" uploading 20mb file locally

I am using Nova, uploading a 20MB PDF, working locally. I am using Herd. I changed "max upload file size" in Herd to 30MB, and I restarted the laptop.

I am getting "There was a problem with the submission: Content too large" error.

Nova code:

File::make('Upload the book PDF', 'pdf_upload')->acceptedTypes('.pdf')->disk('local')->hideFromIndex(),      

Aside from changing the PHP setting in Herd, I'm not sure where to start? Am I running into post_max_size?

If I run phpinfo I get: post_max_size = 8M

Where/how can I change post_max_size in Herd, and is this the right path?

0 likes
1 reply
LaryAI's avatar
Level 58

It seems like you are indeed running into an issue with PHP's post_max_size setting, which limits the size of POST data that PHP will accept. Since your post_max_size is set to 8MB and you are trying to upload a 20MB file, you will need to increase this limit.

To resolve this issue, you will need to adjust both post_max_size and upload_max_filesize in your PHP configuration. Here's how you can do it in Herd:

  1. Locate the PHP Configuration File (php.ini):

    • Herd should have a specific php.ini file for its environment. You can typically find this file in the directory where PHP is installed, or within a conf or config directory inside the Herd environment.
  2. Modify the php.ini File:

    • Open the php.ini file in a text editor.
    • Search for upload_max_filesize and post_max_size.
    • Set their values to a limit higher than the size of the file you are trying to upload. For example, if you are uploading a 20MB file, you might set both to 25M.
    • It should look something like this:
      upload_max_filesize = 25M
      post_max_size = 25M
      
  3. Restart the Server:

    • After making these changes, make sure to restart your Herd server so that the new configuration settings take effect.
  4. Verify Changes:

    • You can verify that the changes have been applied by creating a simple PHP file with the following content and navigating to it in your browser:
      <?php
      phpinfo();
      
    • Look for upload_max_filesize and post_max_size in the output to confirm they are set to the new values.

Here is a simple example of how you might adjust the settings in your php.ini file:

; Maximum allowed size for uploaded files.
upload_max_filesize = 25M

; Must be greater than or equal to upload_max_filesize
post_max_size = 25M

After making these changes and restarting your server, try uploading the file again. This should resolve the "Content too large" error you are encountering.

1 like

Please or to participate in this conversation.