Mailing List Archive

Image uploads - "Save anyway" button
Hi,

I'm running beta4, and when a user uploads a .gif file, the next page just
has the usual warning message (".gif" is not a recommended image file
format.), but neither of the buttons ("Save file", or "Re-upload"). It's a
dead-end.

Is there a regexp/variable somewhere I can set the list of file formats that
do/don't trigger a warning?

Alternatively, is there a setting I need to use to turn on those buttons? I
thought it might be in the MediaWiki:badfiletype message, but it's not.

Thanks,

Oliver
Re: Image uploads - "Save anyway" button [ In reply to ]
Oliver Lineham wrote:
> I'm running beta4, and when a user uploads a .gif file, the next page just
> has the usual warning message (".gif" is not a recommended image file
> format.), but neither of the buttons ("Save file", or "Re-upload"). It's a
> dead-end.
>
> Is there a regexp/variable somewhere I can set the list of file formats that
> do/don't trigger a warning?
>
> Alternatively, is there a setting I need to use to turn on those buttons? I
> thought it might be in the MediaWiki:badfiletype message, but it's not.

There are a lot of settings listed in includes/DefaultSettings.php which
can be tweaked (it's recommended to change the settings always in your
LocalSettings.php to keep customizations isolated).

Since the Unisys LZW patent has now fully expired, we'll probably go
ahead and enable GIF by default in the next release, but for now you can
add it easily enough.

These settings will be relevant to you:

# This is the list of preferred extensions for uploading files. Uploading
# files with extensions not in this list will trigger a warning.
$wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg' );

# Files with these extensions will never be allowed as uploads.
$wgFileBlacklist = array(
# HTML may contain cookie-stealing JavaScript and web bugs
'html', 'htm',
# PHP scripts may execute arbitrary code on the server
'php', 'phtml', 'php3', 'php4', 'phps',
# Other types that may be interpreted by some servers
'shtml', 'jhtml', 'pl', 'py',
# May contain harmful executables for Windows victims
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd',
'cpl' );

# This is a flag to determine whether or not to check file extensions on
# upload.
$wgCheckFileExtensions = true;

# If this is turned off, users may override the warning for files not
# covered by $wgFileExtensions.
$wgStrictFileExtensions = true;

# Warn if uploaded files are larger than this
$wgUploadSizeWarning = 150000;

-- brion vibber (brion @ pobox.com)
RE: Image uploads - "Save anyway" button [ In reply to ]
Brion Vibber wrote:
> These settings will be relevant to you:
>
> # This is the list of preferred extensions for uploading files. Uploading
> # files with extensions not in this list will trigger a warning.
> $wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg' );

> # If this is turned off, users may override the warning for files not
> # covered by $wgFileExtensions.
> $wgStrictFileExtensions = true;

Thanks Brion, that's what I was after. Strange that I couldn't find it on
meta.

Regards,

Oliver