Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#11110 closed defect (bug) (duplicate)

SWF Upload reports file too big even though it is smaller than the max size displayed.

Reported by: brianlayman Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: upload, media, error, swfupload
Focuses: Cc:


The issue is that swfupload.js can trigger a file_exceeds_size_limit error due to two different causes (that I know of) and WordPress assumes the cause is one of them.

In wp_include/script-loader.php, we define the response to file_exceeds_size_limit as:

'file_exceeds_size_limit' => sprintf(('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),

However, either max_post_size or upload_max_filesize can cause an file_exceeds_size_limit.

So, if my max_post_size is the still the default 8M, and my host increased upload_max_filesize to say 16M (from the default of 2M), uploading a 12M file would generate a "This file is too big. Your php.ini upload_max_filesize is 16M" and result in a very confused client.

A solution to this can be found at http://www.php.net/manual/en/ini.core.php#79564 I'm not sure if that's the final code we want, but the idea is the right one... Basically find the min of those two values (converting from M or K or w/e for compatibility) and display THAT in the error message.

Change History (1)

#1 @dd32
12 years ago

  • Milestone Unassigned deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Fixed in trunk, See:

(In [11863]) Show correct max upload filesize error message, props dd32, fixes #10495

Note: See TracTickets for help on using tickets.