Last modified: 2010-04-15 09:29:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T19941, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17941 - $wgMaxUploadSize doesn't affect normal file uploads
$wgMaxUploadSize doesn't affect normal file uploads
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-11 17:25 UTC by R D
Modified: 2010-04-15 09:29 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description R D 2009-03-11 17:25:50 UTC
The $wgMaxUploadSize setting only seems to be active if $wgAllowCopyUploads is enabled. wgMaxUploadSize should work anyway because e.g. sometimes webservers can't handle big pictures, so it must be possible to set the maximum upload size down.

My suggestion is to replace /includes/specials/SpecialUpload.php line 1047:
 $val2 = $wgAllowCopyUploads ? min( $wgMaxUploadSize, $val2 ) : $val2;

with

 $val2 = min( $wgMaxUploadSize, $val2 );

.

I hope I am helpful. :-)
Comment 1 OverlordQ 2009-03-11 17:40:26 UTC
From the documentation of the variable:

Note: This option currently has no effect on the normal upload feature!
Note: The limits for file uploads are controlled by PHP configuration directives. To change the limits for file uploads, you need to modify php.ini, see the upload_max_filesize and post_max_size PHP configuration options as well as Manual:Configuring_file_uploads for details. 
Comment 2 R D 2009-03-11 17:46:31 UTC
And if I don't have access to change PHP ini settings?
Comment 3 Karun 2009-05-09 12:30:21 UTC
An option if you do not have access to change it in your PHP ini settings is to create a .htaccess file 

http://www.php.net/manual/en/configuration.changes.php mentions you can change configuration settings for php using the httpd.conf or .htaccess files.

I do not think there is too much that can be done to restrict the upload size, if you are not able to utilise one of the following methods for configuring php being php.ini, httpd.conf or .htaccess, when you are using the normal upload feature
Comment 4 Roan Kattouw 2009-05-09 13:05:33 UTC
(In reply to comment #1)
> From the documentation of the variable:
> 
> Note: This option currently has no effect on the normal upload feature!

Changing summary accordingly.
Comment 5 Karun 2009-05-10 21:19:48 UTC
I have updated the information on the Wiki in relation to why we cannot restrict the upload size using normal file uploads and this method at http://www.mediawiki.org/wiki/Manual:Configuring_file_uploads#Set_maximum_size_for_file_uploads

An alternative option could be to use JavaScript or Java to check the file size before it is uploaded. If JavaScript is disabled it would not resolve this issue.
Comment 6 Platonides 2009-05-10 21:26:34 UTC
(In reply to comment #5)
> An alternative option could be to use JavaScript or Java to check the file size
> before it is uploaded. If JavaScript is disabled it would not resolve this
> issue.

Firefogg should take into account that limit.

I think that it would be consistent if $wgMaxUploadSize were also enforced for uploads, 
even if PHP configuration has the last word about it. For instance, the php limit may be 
higher than the desired for the wiki in order to support another app.


Comment 7 Karun 2009-05-10 21:47:40 UTC
(In reply to comment #6)
> (In reply to comment #5)

> 
> Firefogg should take into account that limit.
> 
> I think that it would be consistent if $wgMaxUploadSize were also enforced for
> uploads, 
> even if PHP configuration has the last word about it. For instance, the php
> limit may be 
> higher than the desired for the wiki in order to support another app.
> 

I have been trying to find a solution to the problem that is not dependent on ActiveX and using JavaScript. Ive found many examples that use ActiveX such as http://www.codingforums.com/archive/index.php/t-68495.html
With some other solutions I have looked at, browser security restrictions generally prevent them.

I think we need a solution that is not browser dependent, and does not require ActiveX.
Comment 8 Platonides 2009-05-10 23:08:14 UTC
(In reply to comment #7)
> I have been trying to find a solution to the problem that is not dependent on
> ActiveX and using JavaScript. Ive found many examples that use ActiveX such as
> http://www.codingforums.com/archive/index.php/t-68495.html
> With some other solutions I have looked at, browser security restrictions
> generally prevent them.
> 
> I think we need a solution that is not browser dependent, and does not require
> ActiveX.

PHP suggest the MAX_UPLOAD_LIMIT input but the browser's don't take it into account :(

Comment 9 Karun 2009-05-16 01:44:28 UTC
(In reply to comment #8)

> 
> PHP suggest the MAX_UPLOAD_LIMIT input but the browser's don't take it into
> account :(
> 

It appears to be an upstream problem, where we need web browsers to be fixed to check that file size does not exceed a maximum size, before uploading a file.
Comment 10 Bryan Tong Minh 2010-04-15 09:29:26 UTC
r65049

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links