Please or Register to create posts and topics.

No error message when uploading file that is above Max Filesize

My site’s max file size and the Asgaros max file size are both set to 4 MB.

When users attempt to upload a file that exceeds the max size, there is no message that it has been rejected nor is it showing in the post.

If I try to upload two files, a small file and a too-big file, only the small file is posted properly and no message is issued for the too-big file.

Thanks in advance for your attention!

 

Further to the above:

If I set Asgaros limit to 3.5 MB and the site’s limit is still 4 MB and I try to upload a 4.6 MB file,  Asgaros catches and issues an error warning.

If I set Asgaros limit to 5 MB and the site’s limit is still 4 MB and I try to upload a 4.6 MB file,  there is no error message but no file is uploaded.

If I set Asgaros limit to 4 MB and the site’s limit is also 4 MB and I try to upload a 4.6 MB file,  there is no error message but no file is uploaded.

It seems Asgaros does not catch or warn file upload failures due to the site’s Wordpress file size limits.

Hello @ogp-webadmin

It seems that PHP filters/rejects the uploaded files in that case before they reach WordPress. I am not sure if there is a simple way to detect it but I will have a look.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hello again @ogp-webadmin

I pushed a small code-change which should improve the error-handling a bit:

https://github.com/Asgaros/asgaros-forum/commit/b3e29fb9c23115b6c3b5b6e21b722b10af4833b4

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks.  I’ll test it out but I am wondering why you did not just test against wp_max_upload_size() as well.

e.g.     $maximumFileSize = min($this->get_maximum_size_in_bytes(),  wp_max_upload_size() );

… and for extra bonus points, you could test any max Asgaros file size the admin tries to set against the wordpress file size max to make sure we don’t inadvertently try to exceed the site’s max.

https://developer.wordpress.org/reference/functions/wp_max_upload_size/

$max_upload_size = wp_max_upload_size(); // Returns integer number.

Asgaros has reacted to this post.
Asgaros

Hello @ogp-webadmin

Good point, I somehow missed that function. I will add this as well.

The additional handling in the admin area I will keep for later.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!