SupFrig
SupFrig

Reputation: 365

another Wordpress contact form 7 file upload issue

I know this problem is often related, but i'm struggling with the informations i get. I want to make an upload file field which handle files up to 10mo.

here is a sample of my phpinfo :

max_input_time : 300
max_execution_time : 300
upload_max_filesize : 300000M
post_max_size : 300000M
memory_limit : 512M

I also added this line to wp-config.php

define('WP_MEMORY_LIMIT', '64M');

to finish, here's the notation of my file input in contact form 7 :

[file file limit:20mb filetypes:txt|pdf|doc|docx|odt class:fileinput]

with these settings, i can upload files up to 8mo, but i need 10mo. Can't see what's wrong at this point

Upvotes: 0

Views: 12922

Answers (3)

Luqman
Luqman

Reputation: 1

Just a quick fix if someone is still facing the same issue.

contact-form-7/includes/form-tag.php

  • Find the public function:
    get_limit_option( $default_value = MB_IN_BYTES ) {
    
  • Replace with:
    public function get_limit_option( $default_value = MB_IN_BYTES ) {return 99048576;
    
  • Leave the other function code, as it just starts in return with the limit set to 99mb, as the above code.

Upvotes: 0

PJunior
PJunior

Reputation: 2767

To allow files bigger than 1Mb(?), I had to edit

wp-content/plugins/contact-form-7/modules/file.php

and changes 1048576 to 10048576

$allowed_size = 10048576;

This will allow ContactForm7 to accept files until 10Mb files, if we have the server configured to it.

Upvotes: 1

Moishy
Moishy

Reputation: 3638

Try setting the size limit in bytes - the output for 20mb in bytes is 20971520

[file file limit:20971520 filetypes:txt|pdf|doc|docx|odt class:fileinput]

Upvotes: 3

Related Questions