No error message when uploading file that is above Max Filesize
Quote from OGP-WebAdmin on October 9, 2023, 7:39 pmMy 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!
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!
Quote from OGP-WebAdmin on October 9, 2023, 10:51 pmFurther 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.
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.
Quote from Asgaros on October 18, 2023, 11:11 amHello @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.
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.
Quote from Asgaros on October 18, 2023, 11:35 amHello 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
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
Quote from OGP-WebAdmin on October 18, 2023, 4:26 pmThanks. 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.
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.
Quote from Asgaros on October 19, 2023, 4:06 amHello @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.
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.