#10495 closed defect (bug) (fixed)
swfupload file_exceeds_size_limit fails to take into consideration PHP's post_max_size
Reported by: | dd32 | Owned by: | |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Upload | Keywords: | dev-feedback 2nd-opinion |
Focuses: | Cc: |
Description
swfupload file_exceeds_size_limit's localisation string fails to take into consideration PHP's post_max_size ini setting, which may be smaller than upload_max_filesize on badly configured servers.
The result for example, for this config:
upload_max_filesize = 8M post_max_size = 2M
with a filesize of 4M - Result: "This file is too big. Your php.ini upload_max_filesize is 8M."
changing http://core.trac.wordpress.org/browser/trunk/wp-includes/script-loader.php#L193
from
sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
to
sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), min(@ini_get('upload_max_filesize'), @ini_get('post_max_size')) ),
might be a workable solution..
Change History (5)
#2
@
15 years ago
I'm obviously not with it enough to actually read the current message...
I'd prefer to change it to "This file is too big. Your PHP installation is limited to file uploads %s in size." possibly with ", see the 'post_size..' and 'upload_limit..' definitions in your php.ini" if technical details are wanted
#3
@
15 years ago
that's even better, yeah. another one we may want to suggest for trouble shooting would be the memory_limit. frequently, it should be three times the size of the max upload size if any processing needs to occur.
a few years back I've seem 3.2M images that needed to be resized spit out memory limit errors (@8M in this case, it was on a php4.2 server).
I'd personally suggest:
upload_max_filesize is %1$s and post_max_size is %2$s
Else we're bound to have users show up saying WP is reporting erroneous figures.