How to decrease max upload setting inside subfolder

nootkan

Well-Known Member
Oct 25, 2006
173
12
168
I have a form that allows for image uploads and sends them to me via email. I want to decrease the max upload setting from the server setting of 32m to 300kb for this form only. I have tried to create an htaccess file which didn't work. I also tried to create a user.ini file and that didn't work either. Both files were placed inside the form subdirectory. Is there another way to do this? I have searched for a while now with no results that provide me with a solution.
 

HostNoc

Well-Known Member
Feb 20, 2020
157
38
28
Ontario
cPanel Access Level
Root Administrator
Hello nootkan

We reviewed your thread and found that you had created user.ini file instead of .user.ini file.

Once you create .user.ini file then inside that file set these two values

upload_max_filesize = 300kb
post_max_size = 300kb

Hopefully your issue will be resolved.

Regards
 

nootkan

Well-Known Member
Oct 25, 2006
173
12
168
Hi thanks for the reply. I should have provided more info, sorry.

I do have the right file designation just forgot a period in my post.

I also had upload_max_filesize = 0.3M and post_max_size = 0.3M inside the file. When I try to upload a photo of 310kb or 210kb the form just spins its wheels for a long time without sending via email. No errors in log.

When I tried your solution using 300kb I got the following error in my log:

Code:
[15-Jun-2021 03:23:55 UTC] PHP Warning:  POST Content-Length of 239578 bytes exceeds the limit of 300 bytes in Unknown on line 0
[15-Jun-2021 03:23:55 UTC] PHP Notice:  Undefined index: message in /home/mywebsite/public_html/forms/braggin/src/FormHandler.php on line 46
So I changed it to upload_max_filesize = 300000 and post_max_size = 300000 and it worked.

Now to figure out how to tie it into the form with php so anything larger than 300kb will throw an error instead of spinning its wheels. Thanks for the help. Much appreciated.
 
  • Like
Reactions: cPRex