Contact form 7 file upload not sending mail - php

Hello and thanks for reading this.
So my main problem is that i need to allow users to send an maximum 10mb file(doc / pdf). But if someone uploads a file bigger then 2 mb it fails to send the email, but the file is uploaded on server in wpcf7_uploads.
This is my setup
[file file-907 limit:10mb filetypes:doc|docx|pdf]
In file attachment
[file-907]
I also set up htacces to this
<IfModule mod_php5.c>
php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>
And now i am out of ideas and in need of help.

Add this deatil php.ini file:
post_max_size = 25M
default_mimetype = "text/html"
default_charset = "UTF-8"
file_uploads = On
upload_max_filesize = 25M
allow_url_fopen = On
user_agent="PHP"
default_socket_timeout = 60`

Related

CI File Upload file size exceed even after taking several measures

In my Codeigniter based code, I have taken the following measures:
MultiPHP INI Editor in Cpanel
asp_tags = Off
display_errors = Off
max_execution_time = 300
max_input_time = 600
max_input_vars = 1000
memory_limit = 512M
post_max_size = 128M
session.gc_maxlifetime = 1440
session.save_path = "/var/cpanel/php/sessions/ea-php56"
upload_max_filesize = 128M
zlib.output_compression = Off
.htaccess in Home Directory
<IfModule php5_module>
php_flag asp_tags Off
php_flag display_errors Off
php_value max_execution_time 20000
php_value max_input_time 20000
php_value max_input_vars 1000
php_value memory_limit 2G
php_value post_max_size 2G
php_value session.gc_maxlifetime 20000
php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
php_value upload_max_filesize 2G
php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
php_flag asp_tags Off
php_flag display_errors Off
php_value max_execution_time 20000
php_value max_input_time 20000
php_value max_input_vars 1000
php_value memory_limit 2G
php_value post_max_size 2G
php_value session.gc_maxlifetime 20000
php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
php_value upload_max_filesize 2G
php_flag zlib.output_compression Off
</IfModule>
First lines in Controller and Model:
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
ini_set("pcre.backtrack_limit", "100000000");
ini_set("max_allowed_packet ", "2G");
ini_set("max_execution_time ", "20000");
ini_set('max_input_time','20000');
ini_set('memory_limit', '2G');
set_time_limit(0);
$config before file upload
$config=array(
'upload_path'=>$_SERVER['DOCUMENT_ROOT']."/assets/uploads/rpt/",
'allowed_types'=>"rpt",
'overwrite' => TRUE,
'max_size' => '100000000',
'file_name' =>$filename
);
$this->load->library('upload', $config);
$this->upload->initialize($config);
if($this->upload->do_upload('rpt1'))
{
// do something
}
else
{
return "<div class='alert alert-danger'>".$this->upload->display_errors()."</div>";
}
Still I am getting the below message on uploading file greater than 2 MB size:
The uploaded file exceeds the maximum allowed size in your PHP
configuration file.
What else is the solution?
You need to set the value of upload_max_filesize and post_max_size in your php.ini :
; Maximum allowed size for uploaded files.
upload_max_filesize = 50M
; Must be greater than or equal to upload_max_filesize
post_max_size = 50M
After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.
If you can't change your php.ini, you're out of luck. You cannot change these values at run-time; uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set.
OR
Even you can set in .htaccess file of project
php_value upload_max_filesize 50M
php_value post_max_size 50M
Finally I opened the WHM to edit php INI settings. making changes there corrected the issue.

How can i resolve upload_max_filesize issue

I have faced issue of upload_max_filesize , I have updated php.ini file on server with adding following.
memory_limit = 500M
post_max_size = 500M
file_uploads = On
max_execution_time = 600
max_input_time = 900
upload_max_filesize =500M
Also I have updated .htaccess file like..
<IfModule php7_module>
php_flag display_errors
php_value post_max_size 500M
php_value max_execution_time 330
php_value max_input_time 260
php_value max_input_vars 1000
php_value memory_limit 500M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
php_value upload_max_filesize 500M
</IfModule>
But still i am getting same error The uploaded file exceeds the upload_max_filesize directive in php.ini , I just trying to upload 2MB video but getting same error.
Why does it i happen i don't know , I have also words with server support center and they told me that they have set 500MB max_upload_size.

Where do I set the maximal POST length in PHP? [duplicate]

There is a lot of data being submitted no file uploads and the $_SERVER['CONTENT_LENGTH'] is being exceeded. Can this be increased?
There are 2 different places you can set it:
php.ini
post_max_size=20M
upload_max_filesize=20M
.htaccess / httpd.conf / virtualhost include
php_value post_max_size 20M
php_value upload_max_filesize 20M
Which one to use depends on what you have access to.
.htaccess will not require a server restart, but php.ini and the other apache conf files will.
I had a situation when variables went missing from POST and all of the above answers didn't help. It turned out that
max_input_vars=1000
was set by default and POST in question had more than that.
This may be a problem.
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
You can do this with .htaccess:
php_value upload_max_filesize 20M
php_value post_max_size 20M
We can Increasing the maximum limit using .htaccess file.
php_value session.gc_maxlifetime 10800
php_value max_input_time 10800
php_value max_execution_time 10800
php_value upload_max_filesize 110M
php_value post_max_size 120M
If sometimes other way are not working, this way is working perfect.
You can increase that in php.ini
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
I had been facing similar problem in downloading big files this works fine for me now:
safe_mode = off
max_input_time = 9000
memory_limit = 1073741824
post_max_size = 1073741824
file_uploads = On
upload_max_filesize = 1073741824
max_file_uploads = 100
allow_url_fopen = On
Hope this helps.
You can specify both max post size and max file size limit in php.ini
post_max_size = 64M
upload_max_filesize = 64M
Try
LimitRequestBody 1024000000
php.ini
Change setting max_input_vars from default 1000 to 10000 for enought json post data.
It worked for me.
max_input_vars=10000
Only add the below 3 lines in .htaccess file, which is in your root folder of the project.
php_value memory_limit 500M
php_value post_max_size 500M
php_value upload_max_filesize 500M
It will completely assist you in resolving your problem.

How could I increase my maximum file upload size in wordpress?

I am currently using the .htacces method to achive this
Here is what I am using so far
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
But each time I am getting error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
The better way is to change its settings through php.ini file. Find/change following options:
upload_max_filesize = 100M
post_max_size = 100M
Save this code in any php file and update it in the plugins directory and activate that plugin:
ini_set('upload_max_size','256M');
ini_set('post_max_size','256M');
ini_set('max_Execution_time','600');
You can put these lines before or after any other script in you .htaccess file. Save it and upload. That's it! Hope this helps!
#Change upload limits
php_value memory_limit 34M
php_value post_max_size 33M
php_value upload_max_filesize 32M
php_value max_execution_time 600
#Change upload limits end
In your php.ini file insert the following lines of code into it if it is not there and increase upload_max_filesize according to your requirements:
memory_limit = 100M
upload_max_filesize = 200M
post_max_size = 100M
file_uploads = On
Ok great, I just got it!!
Adding the followwing code in "wp-admin" folder does the trick
memory_limit = 100M
upload_max_filesize = 200M
post_max_size = 100M
As a summary of the above:
I add the following code in the .htaccess file in the directory wp-admin:
php_value memory_limit 34M
php_value post_max_size 33M
php_value upload_max_filesize 32M
php_value max_execution_time 600
and it worked.

PHP File Upload second file does not upload, first file does without error

So I have a script I have been using and it generally works well with multiple files...
When I upload a very large file in a multiple file upload, only the first file is uploaded. I am not seeing an errors as to why.
I figure this is related to a timeout setting but can not figure it out - Any ideas?
I have foloowing set in my htaccess file
php_value post_max_size 1024M
php_value upload_max_filesize 1024M
php_value memory_limit 600M
php_value output_buffering on
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.cookie_lifetime 0
php_value session.gc_maxlifetime 259200
php_value default_socket_timeout 259200

Categories