Jump to content

Talk:Uploading files/Archive

Add topic
From Meta, a Wikimedia project coordination wiki
Latest comment: 10 years ago by 88.130.106.61 in topic Cannot write to image.php...?

Wrong info gopi sunder

Cannot upload PDFs

[edit]

I cannot upload PDFs to my wiki. I am logged in as a sysop. I can upload images just fine. The research I have done leads be to believe these changes in LocalSettings should do the trick, but they don't... The public directory is now 777. I don't an error message.

$wgEnableUploads       = true;
$wgAllowExternalImages = true;
$wgAllowCopyUploads 	= true;
$wgAllowImageMoving		= true;
# $wgUseImageMagick = true;
# $wgImageMagickConvertCommand = "/usr/bin/convert";
# allow more file types:
$wgFileExtensions[] = 'pdf';
# trying to get pdfs to work
$wgVerifyMimeType = false;
$wgStrictFileExtensions = false;
$wgCheckFileExtensions = false;
## $wgMimeDetectorCommand = "file -bi"; 
ini_set( 'memory_limit', '64M' );
/** This is a flag to determine whether or not to check file extensions on upload. */
$wgUploadSizeWarning = true;

Any advice? --Two7s clash 16:08, 23 April 2010 (UTC)Reply

File Uploads in MediaWiki

[edit]

I am able to upload standard image files to my wiki but i cant upload non-image files such as PDF's, Mp3's ..etc.. When i attempt to upload them i usually receive the message ".xxx is not a recommended image file format." sometimes i receive the message "The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file." But i know the file does exist because i had to browse to it in order to attempt to upload it. Any suggestions? Dtii

The same with me - I want to upload a swf file (and will give the Flash extension a try). I changed LocalSettings.php, DefaultSettings.php, php.ini and even had a look at my httpd.conf regarding Apache's LimitRequestBody directive (although the docs say, default is 0 which means no limits). I still get the error saying my file is zero length. Do you have any idea? Frank Mahler 08:08, 20 Apr 2006 (UTC)

i was able to answer my own question.. in case anyone runs across this issue..
Go into $wikiRoot\includes\DefaultSettings.php and set $wgStrictFileExtensions to false (defaults to true). By default extensions other than 'png', 'gif', 'jpg', 'jpeg' are not allowed setting the above mentioned variable to true will allow users to upload "semi-safe" extensions such as pdf, mp3 .. files such as exe, scr, pip, php are "black-listed" so even that step wont allow uploads. In order to get these guys to upload you would need to set $wgCheckFileExtensions to false (default=true).. which is probably not a good idea.. This documentation is based on WikiMedia 1.4.4 Dtii friday may 13 2005
There's also a $wgFileExtenstions variable in DefaultSettings.php that lets you decide what extensions can be uploaded
Other CMSs restrict what can be uploaded by file extension (.jpg, .gif, etc), so instead of configuring Apache to avoid loading html/php from the upload directory (not an option for many people), perhaps a similar configuration can be added for MediaWiki. -- Mage 16:03, 27 Oct 2004 (UTC)

".xxx is not a recommended image file format." problem solved: I found that even though I had set $wgFileExtensions, $wgCheckFileExtensions, $wgMimeDetectorCommand, and $wgStrictFileExtensions as suggested by others, I could not upload the files I wished. I added a line to LocalSettings.php

$wgFileBlacklist = array(...);

(substitute the ellipsis for your list of files) which overrides the default blacklist. If you do not have this line in your LocalSettings.php file, your wiki config will read from include/DefaultSettings.php. You can use DefaultSettings.php as a model for this, copy the lines to LocalSettings.php and add or remove file extensions to match your requirements. Phil Hurvitz 22:30, 14 January 2009 (UTC)Reply

I'm trying to upload a simple SVG file into my new 1.5.7 installation. I set $wgStrictFileExtensions = false to allow semi-safe extensions. This got me a bit further (incidentally, you should put this kind of variable assignment line into LocalSettings.php such that it overrides assignments in DefaultSettings.php, rather than editing DefaultSettings.php)
...but now I get "This file contains HTML or script code that my be erroneously be interpreted by a web browser." (complete with typo). Is there something else I need to switch off? here's the SVG file I'm trying to upload -- Harry Wood 18:07, 7 March 2006 (UTC)Reply
Ah. I see this relates to bug 4388. '<title>' tags are not allowed in SVG files. -- Harry Wood 12:06, 8 March 2006 (UTC)Reply

HTML file uploads

[edit]

See how to enable HTML file uploads here: [1]

Do you help me please...

[edit]

I have the instalation of the mediawiki in my web site, but, I can´t Upload file, and appear this text: Sorry, uploading is disabled. I look information for resolve this problem, but I didn´t founded information, and I need put some images in my web site.

http://www.laboratoriodiseno.com/index.php?title=Special:Upload

This is answered in the [[2]]. --brion 06:19, 8 Apr 2005 (UTC)

A: Add to the end of LocalSettings.php: $wgDisableUploads = false; -- and for the upcoming 1.5 release, this will be $wgEnableUploads = true; -- Sy / (talk)

I have the same problem

[edit]

i have all things on true and the directory is writble but i cant upload. what is wrong ?

Blank screen when uploading files

[edit]

I have the same problem. Blank screen (IE or Firefox) always is displayed after uploading files. I am using MediaWiki 1.5.6, PHP 4.3.4, Apache 2.0 and MySQL 4.0.18. Files could be uploaded when I use version MediaWiki 1.4.X. Pls, Help me solve this bug. Thanks

Corrupt files?

[edit]

I get this errormessage when trying to upload images (jpg or png):

The file is corrupt or has an incorrect extension. Please check the file and upload again.

The images directory is writeable and disableuploads set to false, using mediawiki 1.4.0. please help!

-- I'm getting this as well, except with a PDF on MediaWiki 1.5b3. I've allowed PDFs in the extension array, and the file uploads fine to a 1.4 wiki.
-- Also I'm getting it with images. TXT files work fine though.
-- I have the same problem. I use MW v1.5.3
-- I have also the problem... when I changed the $wgVerifyMimeType to false in LocalSettings.php, I could upload .png, but the page always says, that the file is "text/plain" and could properly consists viruses. I cannot view the Image on Wikipages, and I know, the file isn't corrupt, because I've made the image by myself with GIMP and Paint, and I'm using a localhost-installation, so that it can't be an upstream problem.


  • The solution is add an external mime detector in LocalSettings.php
$wgMimeDetectorCommand= "file -bi"; #use external mime detector
http://db.glug-bom.org/wiki/index.php/Setup_a_MediaWiki
-- This fix worked 1.6.7
I'm having problems with this but none of the fixes has worked. I don't have problems uploading image files but when I try to do XLS or PPT files I get the error. I was able to add PDF files to the array and it works, but not these two. The $wgVerifyMimeType = false; and $wgMimeDetectorCommand = "file -bi"; have had no effect on it at all. I don't know what to do from there besides give up. Any ideas? I had this problem on my previous install and just upgraded to 1.10.

Batch Uploads?

[edit]

Is there any way to "upload" a large batch of pictures to a local instance of mediawiki? Is there a workaround? I know this sounds stupid (just link to them, dumbass) but I'd like them to have pages, thumbnails, etc...

http://pywikipediabot.sf.net/

A: There is no current way that I know (as of v1.4.2) .. I have the same concern.. it would be nice to be able to batch upload. -- Sy / (talk)

Restricting upload to user roles

[edit]

Is there a way to restrict the upload to user roles or special users?

A: No, although 1.5 might be able to do that when it comes out. -- Sy / (talk)

Uploading ascii text files

[edit]

Is there a way to upload (or link to) ascii text files with text formatted in wiki format so they look like wiki pages when accessed? All I get is ascii text (with all the formatting commands visible) when I try it.

This feature would be useful for automatically updating files, or updating them remotely without needed a window system.

A: No, you would have to cut-and-paste the text into a wiki page. -- Sy / (talk)

Path name clarification

[edit]

In the Caution section of the content page, the following Apache setting is recommended to prevent an uploaded file from executing script code:

In httpd.conf, add these lines:
    Alias /upload /..../upload
    <Directory "/..../upload">
    Options None
    php_flag engine off
    </Directory>
Replace "...." with your path name.

But it is not clear which path name is expected. Is it the path to root folder of the web server? The path to your images folder?

Is this Apache setting even necessary given that files with .PHP, .EXE etc. exetensions are blacklisted by MediaWiki by default (as mentioned elsewhere on this discussion page)?

A: It's the images folder that you're worried about. You don't want people uploading executable files and then having them or other people able to execute the file. This is very important in cases where the wiki administrator has chosen to allow other file extensions to be uploaded. -- Sy / (talk)

Q: An other problem is that apache 1.3.33 does not like the php flag.

# apachectl configtest 
Syntax error on line 375 of /etc/apache/httpd.conf:
Invalid command 'php_flag', perhaps mis-spelled or defined by a module

Q: Is it not better to change the 'upload' in the example to 'images'? Because the default install uses this name.

The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file. (solved)

[edit]

I am unable to upload images. I used to be able to, but something changed in my setup and I didn't realise that I not only nuked all my images but now image uploading won't work.

Some info:

  • MediaWiki 1.4.2
  • PHP5
  • safe_mode is on (i've tried turning it off)
  • folder permissions should be ok (all set to nobody, all 777)
  • php.ini has upfile_uploads = On load_max_filesize = 2M and post_max_size = 2M
  • File is an allowed extension (.jpg)
  • I have permission to read the image.
  • File is a valid image (and not 0 bytes).

None of these things should be an issue, as uploading used to work and these settings have not been tampered with since it was functional.


Here is my self-solved solution:

edit php.ini with upload_tmp_dir = /tmp/http

mkdir /tmp/http
chmod 777 /tmp/http

GREAT!! I don't know to do, this is the solution for me.

I have this problem, too. Configuration is

  • MediaWiki 1.4.4
  • PHP 4.3.11
  • safe_mode is off
  • image folder has permission 777
  • php.ini has upfile_uploads = On load_max_filesize = 8M and post_max_size = 2M
  • File extension and size okay and readable

I can't change my php.ini and don't want my images in /tmp/http

Any suggestions? thx, Robert

-- Sy / (talk)

Image files not appearing

[edit]

I can upload a jpeg file (which I can verify by looking at the server's Wiki directory) but when I link to it with a link such as Image:edlheadshot.jpeg, I get the error message:

Missing image
Edlheadshot.jpeg
Image:edlheadshot.jpeg

This is on a local install of MediaWiki. I'm running Mac OS X 10.4.1 (Tiger). What am I doing wrong?


  • Try playing with the capitalization of the filename. Specifically, try Edlheadshot.jpeg. To confirm the filename, check it on Special:Imagelist.

I can also upload files without any problem, and the image page shows and does not give any error (not even 'Missing image' above), and I've checked files are correctly uploaded to the server. However, the image page does not show any image. See it here: http://wiki.silentcolors.net/index.php?title=Imagen:Invierno.png

  • try to toggel this setting
$wgUseImageResize = true;

Because it interferes with "Preferences -> Files -> Limit images on image description pages to 800x600px"

Q: I am also facing the same problem. I can upload the file (jpg, png) but images are not getting displayed.

Please help me what to do.

All File Uploads tagged as Image:*

[edit]

Is there anyway to categorize uploaded files? On the default upload page are these instructions...

use a link in the form [[Image:file.jpg]] or [[Image:file.png|alt text]] or [[Media:file.ogg]] for sounds.

but there does not seeme to be a way to change it from Image to Media, etc. I uploaded an ogg file and it automatically called it Image:*.ogg and not Media:*.ogg.

Thanks for your help.

Those are different types of links which do different thing. The file description page is always at 'Image:' for historical reasons. --brion 22:59, 15 Jun 2005 (UTC)
Is there a way to change "Image:" to "File:" for example? 90.224.64.228 11:00, 28 October 2006 (UTC)Reply

Cannot write to image.php...?

[edit]

Here's the error I'm experiencing

<b>Warning</b>: imagepng(): Unable to open '/home/mypath/public_html/wiki/images/thumb/5/5b/535px-Screenshot.gif' for writing in <b>/home/mypath/public_html/wiki/includes/Image.php</b> on line <b>610</b><br /> <br /> <b>Warning</b>: stat(): Stat failed for /home/mypath/public_html/wiki/images/thumb/5/5b/535px-Screenshot.gif (errno=2 - No such file or directory) in <b>/home/mypath/public_html/wiki/includes/Image.php</b> on line <b>1042</b><br />

Just moved servers, and I'm just stumped on how to fix this. Any ideas? --Wolf530 04:17, 13 July 2005 (UTC)Reply

The images directory (and it's subdirectories and the files in it) must be writeable by the web server. A recursive chmod 777 will probably fix this fast. --Klaws 08:18, 25 July 2005 (UTC)Reply

It might be a fast fix but are there any security issues associated with 777 permissions on the images directory? --M100 10:48, 5 August 2005 (UTC)

Yes, if you use 777 permissions every' user has write and execute permission in the folder inside the webroot. This is way worse than not being able to upload files! --88.130.106.61 00:02, 1 May 2014 (UTC)Reply

How do I enable image versioning?

[edit]

How How do I enable image versioning? When I view an image page in the wikipedia there is an option to 'Upload a new version of this file'. I've have file uploads enabled and working on my installation of media wiki but I am unable to figure out how to use or enable file versioning. And I can't find any help regarding this issue here either!

Any help will be most appreciated, thanks.

There's nothing to enable. Just upload another file with the same name. --brion 09:47, 23 July 2005 (UTC)Reply

No Thumbnails

[edit]

I have a problem of thumbnails not appearing. I can upload images just fine, and they work, but no thumbnails are generated and the alt text is displayed instead. I'm running in safe mode, using the internal (GD) generator, and the file and directory permissions are correct, the www-data user can write to all three directories, it works in the archive directory, but I get no thumbnails, no error message either.

Any ideas? Tom Vogt <tom@lemuria.org>

thumbnails are not created on upload. did you use [[Image:filename.jpg|thumb]] to display the image? egi

Yes, I used: [[image:screenshot.jpg|right|thumb|sample screenshot]] and no luck. (Tom)

I had a similar problem, had created a thumbs dir, not thumb under my image path. I saw an error msg in the apache error_log saying File does not exist: .../wiki/image_files/thumb/180px-filename.jpg which was the hint I'd got the wrong dir.

do you have ImageMagick or libgd installed?

I have the same problem, libgd was installed (2.0.33), but thumbs aren't visible, too. (Daniel, 7th November 2005)


I have the same problem - On 1.8.0 - with ImageMagick installed ... it has full access to the Thumb folders and even created the full path to the thumb file as it should but no thumb image? if I manually run ImageMagick convert and create the file named the correct name it appears on the page but it will not create them itself ???

Same problem - the full path (images/thumb/1/12/ImageName.jpg/) is created, but no thumbnail. I am using mediawiki 1.6.8 and version 6.0.7 of convert. What could be the problem? -- Wil
Most likely, the problem is that your php has no shell execution rights (check /var/log/httpd/error_log for a message like
 PHP Warning:  shell_exec() has been disabled for security reasons)
In order to overcome this problem, the option shell_exec has to be removed from the line disable functions" in the php configuration file /etc/php.ini -- Wil (84.113.249.152) 21:47, 26 March 2007

Deleting files once they are uploaded?

[edit]

Any way to delete the file once it has been uploaded? In the file detail list page there is a (del) (cur) and it mentions use (del) to delete an version, but there is no link active?

  • Can you log in as an Administrator (Superuser)? If so, when you go to the list of uploaded files, you can view the desc (details) page on each one and click delete in the top tabbar. Jcobbers 15:04, 30 January 2006 (UTC)Reply

internal error

[edit]

when i try to upload jpg file, internal error occures:

Internal error Cannot copy file "/tmp/php72CqHw" to "/home/mworoch/public_html/wiki/images/2/28/Lol.JPG".

why should i do? thanks in advance 28 VIII 05

Check the owner/permissions on the upload dir .../wiki/images There's a $wgHashedUploadDirectory setting mentioned in Uploading_files not sure if that's related. Not sure how you got that path (/2/28/) in the uploaded name, but there may be problems w/ not having those dirs created beforehand.

I have the same problem and followed the instructions to get out of safe mode in Uploading_files, but that still didn't work. Anyone have any ideas?


I had the same problem, and I just fix it... the problem is, i am not sure what did I do. Anyways, my conclusion is that it is not a problem with MediaWiki, so leave the config files; I was changing things in my server (IIS), and found some errors. One error was that _vti_bin hadnt execution permissions. To fix that, i right clicked on 'Default Web Site' -> all task -> check server extensions (actually, Im not sure if it's like that, I have windows in spanish, sorry). Good luck.

yeap, it was a permissions problem with IIS.

  • I get the same problem, can someone guide me through the steps to fix it?

I have similar kind of problem ?Can anyone help me? how to set things in IIS for this to work

Set the filesizelimit of a user

[edit]

I'm looking for a possiblility to limit the accountsize of the users. I'm also trying to set a limit to the size of the whole wiki so that it can't be used to exchange files. Can anyone help me??

Network Files / Images

[edit]

Rather than upload files to the wiki server we would rather link to the files on the Network directly using the file:/// protocol. However this does not seem to work providing only a [file:///server/route/to/file/image.jpg] entry on the page rather than an embedded link or image. Linking to files on an external http server seems to work ok.

you need to install the FileProtocolLinks extension [3]

Firefox users need the locallink add-on [4] to get external links working

The upload directory (/home/ninja999/public_html/mwiki/images) is not writable by the webserver.

[edit]

What does this mean? Go here: http://www.nictitatingrabbit.com/mwiki/index.php/Special:Upload to see. Why would this happen?

The upload directory (/home/ninja999/public_html/mwiki/images) is not writable by the webserver.

Allow certain filetypes for only a group of users

[edit]

On a wiki I have, I'm going to be installing the Flash extension. This means I'll be allowing .swf uploads. However, due to some security concerns, I was wondering if it was possible to only allow a certain group of users to upload .swf files. Is it possible? -- Super Sam 01:56, 31 December 2005 (UTC)Reply

Pictures not appearing...

[edit]

Hello, for a couple of week, I uploaded my pictures with no problem. But recently I've been having some problem. I upload the fil, but after I uploaded it, the pictures do not appear in either the image page or the page I embedded the image in. What should I do?


Images (Files) only for known Users...

[edit]

Hi,

I set up a Wiki for just a short group of members. They are allowed to do anything ;-) All other visitors can only see the Start-Page. Is it possible to hide the images-directory from those not-known-users? Maybe with htaccess?

look at img_auth.php in wiki-Directory -- 12:11, 27 Jan 2006 (UTC)

I've tried to use img_auth.php, according to the comment in it, it state:

To use, in LocalSettings.php set $wgUploadDirectory to point to a non-public
directory, and $wgUploadPath to point to this file. Also set $wgWhitelistRead
to an array of pages you want everyone to be able to access. Your server must
support PATH_INFO, CGI-based configurations generally don't. 

so I set my LocalSettings.php as following

$wgUploadPath       = "$wgScriptPath/img_auth.php";
$wgUploadDirectory  = "$IP/images";

but it doesn't work, all my images in Wiki become not viewable because of the wrong path, is there something I did wrong? and what exactly is PATH_INFO support? I'm suing Apache 2.2 under Windows XP. Could someone give the example on how to use img_auth.php, much appreciated!

After I set the $wgUploadPath to point to this file, the image path becaome "http://www.myserv.com/wiki/img_auth.php/6/6f/e/image.png", and it looks like the img_auth.php script just don't run at all and instead the browser look for the directory "img_auth.php" which of cause doesn't exist. Is there anything I did wrong? do I have to do anything in http.config to turn the PATH_INFO on and if so how to do that?

New Configuration Page Added Image Authorisation --Jack 17:05, 22 April 2007 (UTC)

[edit]

Unable to view png images on wiki

[edit]

Hi

I can upload png file into wiki. but when i insert the command [[[Image:file.png]] in the web page the image does not show up. When i click on the link i get "No file by this name exists".

I checked the mysql wikidb and the images are classifed as text / plain.

Is this a problem?

How can i fix this?

It is on this forum as well

[5]

Could not copy file

[edit]

I am using version 1.6. I have removed the # from in front of the $wgEnableUploads and set it to true. Now I get the following message when I upload files:

Could not copy file "/tmp/phplnDb3v" to "/var/www/html/wiki/images/3/30/Aar010.gif".

I have looked for php.ini to see if I could move it manually but could not find it. Any help is appreciated

I get that too, I've tried everything. --75.26.140.138 19:08, 13 June 2007 (UTC)Reply

Fatal error: mime_magic could not be initialized, magic file is not available in /opt/lampp/htdocs/includes/MimeMagic.php on line 506

[edit]

Help!!!!! I get this message when trying to upload files to my wiki!

Fatal error: mime_magic could not be initialized, magic file is not available in /opt/lampp/htdocs/includes/MimeMagic.php on line 506

If that is a linux box, set $wgMimeDetectorCommand= "file -bi" in LocalSettings.php. Alternatively, find out where you magic.mime file is and set mime_magic.magicfile accordingly in your php.ini -- Duesentrieb 10:17, 22 May 2006 (UTC)Reply

404 Error after uploading image

[edit]

Please help. After uploading images onto my page I get a page saying: 404 Not Found nginx/0.3.46 What should I do?

- I got exactly the same problem. Can someone help?

- I got exactly the same problem. Can someone help? 20100712 nginx 0.7.65

Possible Solutions

[edit]

Try either this: http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title_--_nginx_rewrite--root_access or disabling short urls entirely by adding the following to the end of your LocalSettings.php file: $wgUsePathInfo = false;

Hope that helps

Unable to enable uploads despite exhausting efforts

[edit]

First, I've read the following pages that have to do with enabling uploads on mediawiki:

I've also googled and couldn't find anyone having the same issues as me. They are all errors that I wish I had. :)

I have MediaWiki version 1.6.7

Here is the section of my LocalSettings.php having to do with enabling uploads:

# Enabling Uploads to the wiki/uploads directory
$wgEnableUploads    = true;
$wgUploadPath       = "$wgScriptPath/uploads";
$wgUploadDirectory  = "$IP/uploads";
$wgFileExtensions   = array('png','jpg','jpeg','pdf','zip','tar.gz');
$wgUploadSizeWarning= 250 * 1024;
$wgMimeDetectorCommand= "file -bi"; #use external mime detector

I've made the directory wiki/uploads 755, I've also had my host change the owner from me to apache.

For your information, here are the values of each variable in my LocalSettings.php:

$wgScriptPath=wiki
$IP=/home/clubsav/public_html/forums/wiki

Any help would be extremely appreciated. Thanks 198.80.151.230 01:10, 27 June 2006 (UTC)Reply

Fixed, found an extra: $wgEnableUploads = false; hiding in my LocalSettings. Thanks 198.80.155.6 02:04, 28 June 2006 (UTC)Reply
I got snared by the same silly problem with MediaWiki 1.7.1, so I added a warning in the FAQ entry on Uploading files/Archive. Teratornis 02:53, 18 November 2006 (UTC)Reply

Re-uploading through external application (tricky)

[edit]

I would like that opening a file, e.g., [[Media:Test.txt]] with an external editor, say emacs, and changing this file, I were able to save the changes, that is to upload it to overwrite the previous file on the hosting server, not going through the history process of the wiki.

In the case at hand I'd have to upload a file

http://localhost/testwiki/images/3/35/Test.txt

which attempts KIOexec (under KDE/Linux running apache2) understands and tries, but it encounters the following:

Access was denied while attempting to upload http://localhost/testwiki/images/3/35/Test.txt.

Provided that I have access as root to all servers/files, who is responsible for denying this operation and how to fix it? (I checked all wg-upload options and all filesystem permissions).

Laussy 16:56, 1 July 2006 (UTC)Reply

Information on directories

[edit]

I am trying to figure out the contents of the directories, please assist.

All images will be stored in the directories below /images. There are a number of subdirectories:

  • 0-f: Main storage. All images will be placed here in their original size. Each directory has another subdirectory: x0-xf; x = Name directory, e.g. /images/1g.
  • archive: like 0-f; what is it used for? What happens if you delete images?
  • temp: temporary directory. Probably for safe upload. This directory often has a lot of old entries or are these still in use. How is it cleaned? Do you need to clean manually?
  • thumb/0-f: goes exactly to 0-f: Thumbnails (generated automatically) for all images in 0-f. Each file will have its own directory, which uses a lot of space unnecessary (4KB for each folder)

Calculation of space used for a picture (block size 4KB Linux):

  1. size of image
  2. size of thumbnail
  3. directory for Thumbnail (4KB)
  4. directory for image (will be used for multiple images, not so relevant)

Storage size for directories:

  • 0-f: Max 16*16 = 256 directories = 256*4 = 1024 KB
  • Archive 0-f: Max 16*16 = 256 directories = 256*4 = 1024 KB
  • Thumbs 0-f: Max 16*16 = 256 directories = 256*4 = 1024 KB
  • Thumbs: a directory for each thumb (4 KB)

Will make 3MB for directories only, not counting thumbs!

example:

  • image 20778 Byte: 24 KB image space + 4 KB directory space + 4 KB thumbnail + 4 KB directory thumbnail = 36KB

Information on safe mode upload

[edit]

Safe mode upload is enabled by default. What disadvantages does disabling have?

None if php is configured correctly. Else, $wgHashedUploadDirectory needs to be set to false because image dirs would not be created.

Linking to .mov files (Quick Time) won't work

[edit]

After: allowing uploading of .mov files to my wiki, successfully uploading a certain .mov file and watching it from the page I've been directed to, I found my wiki won't link to it. If I type, for instance, Media:Example.mov (assuming my .mov file's named Example), I'd get a red link, leading to "Upload file" page. What am I doing wrong? --87.69.58.71 17:50, 4 November 2006 (UTC)Reply

[edit]

I installed and got my wiki running on my PC at work. I intend to make this our intranet and this installation is to show people what we can do and how we can use a wiki in this context. I was proceeding quite nicley and I have uploaded several images into the site. However I am now getting this message: "." is not a recommended image file format. and images will no longer upload.

I have checked my localsettings.php and all looks fine. I have read lots of pages about enabling uploads and getting files onto my wiki (mediawiki-1.8.2)

I have also tried googling an answer but cannot get anywhere.

I have MediaWiki version 1.8.2

Any help would be extremely appreciated. Thanks Jamesh008 09:43, 6 November 2006 (UTC)Reply
Fixed: I noticed that the image link did not have a valid extension.Jamesh008 21:48, 7 November 2006 (UTC)Reply

It would be nice if each MediaWiki error message linked to its own page on, say, Meta that would explain the following two things:
  • What the error message means.
  • How to fix the error.
Writing informative error messages is, of course, a basic principle of software design which, unfortunately, hardly any programs fully adhere to. The main problem is that programmers do not document all the error messages they code, but even if they wanted to, often they don't really understand what their error messages mean at the time when they write them. Some errors only begin to make sense after real users generate the errors, and someone debugs the errors. With traditional software, there is no efficient mechanism to accumulate this debugging experience back into a program, but with MediaWiki we have wiki technology. It would be great if every MediaWiki error message linked to its own page on Meta, where we could accumulate all the causes and solutions we discover for each error. At a minimum, each error message should have its own distinct code, so we can tag all our discussions of the error with the code, and then future victims can search efficiently for it. — Teratornis 19:39, 20 November 2006 (UTC)Reply
    • For the error above, the key piece of information missing from the message is (possibly) that the output of this command:
    • $wgMimeDetectorCommand= "file -bi"; #use external mime detector indicates a file type that does not match the file extension; or (possibly) that the extension of the file is not a member of the list of allowed file extensions in $wgFileExtensions. It would be nice if the error message displayed more of what led to the vague inference: "." is not a recommended image file format. The current form of the message raises more questions than it answers: what is a recommended image file format? How does the software decide what format is "recommended" and why does the software think the current file format is not? Answering these questions forces each user who gets the error to undertake a research project, because the message does not expose the key information which is within the software that would allow the message to make sense. — Teratornis 19:39, 20 November 2006 (UTC)Reply

NOTE:

This error is also caused when the "Destination Filename" does not have an extension. I notice this problem when I wanted to link and upload a file called "filename.pdf". First, I created a link using the [[Media:filename]], saved the page, then clicked on the link to have mediawiki automatically ask for the upload. In doing so, mediawiki auto-filled the "Destination Filename" with "filename." The problem is that "filename" does not have an extension, and causes MediaWiki to kick back the error. Changing the original [[Media:filename]] to [[Media:filename.pdf]] fixed the problem! Hari Boukis

How to reference last upload date ?

[edit]

We have frequently updated files in our Wiki, and would like to see the last upload date appear in the reference page. Is it possible ? How to proceed ?

Restrict upload of certain file types to certain group

[edit]

I want to upload ZIP and TAR files to my wiki. This works by adding 'zip' and 'tar' to the

$wgFileExtensions

variable in LocalSettings.php. But since that allows any user to upload malicious files, I want to restrict the upload feature of ZIP and TAR files to a certain group, e.g. by declaring something like

$wgGroupPermissions['foo']['upload'] = array('gif','png','jpg','jpeg','wmv','mov','zip','tar');
$wgGroupPermissions['*']['upload'] = array('gif','png','jpg','jpeg','wmv','mov');

which of course is not supported. Is there another way to solve that issue? 82.135.62.159 08:18, 12 January 2007 (UTC)Reply

A: I have written a mediawiki extension "UploadFileExtensionsPermissions.php" that solves that for me

Example: (allow protected zip and tar file upload to group 'coder')

Add these lines to LocalSettings.php:

$wgFileExtensions = array('gif','png','jpg','jpeg','zip','tar');
$gProtectedFileExtensions = array('zip','tar');
$wgGroupPermissions['coder']['upload_protected'] = true;
require('extensions/UploadFileExtensionsPermissions.php');

UploadFileExtensionsPermissions.php:

<?php
  
/**
 * Extension for protected file upload for certain file types.
 * author: Michael Karneim
 * date: 12-JAN-2007
 *
 * Usage in LocalSettings.php:
 *   Add protected file extensions to $wgFileExtensions.
 *   Define $gProtectedFileExtensions as array of protected file extensions.
 *   Assign 'upload_protected' in $wgGroupPermissions to each group that is
 *    allowed to upload protected file types.
 *   Require "UploadFileExtensionsPermissions.php" extension.
 *
 * Example: (allow protected zip and tar file upload to group 'coder')
 *   $wgFileExtensions = array('gif','png','jpg','jpeg','zip','tar');
 *   $gProtectedFileExtensions = array('zip','tar');
 *   $wgGroupPermissions['coder']['upload_protected'] = true;
 *   require('extensions/UploadFileExtensionsPermissions.php');
 */

# Attach hook
$wgHooks['UploadVerification'][] = 'protectedFiletypeUploadVerification';

/**
 * Function is called whenever a file is going to be uploaded.
 * returns true is upload is allowed, false otherwise.
 */
function protectedFiletypeUploadVerification($saveName, $tempName, &$error) {
  global $wgUser;
  global $gProtectedFileExtensions;
  $pos = strrpos($saveName, ".");
  $ext = strtolower( substr($saveName, $pos+1));
  if ( checkFileExtension($ext, $gProtectedFileExtensions)) {
    # File has a protected extension
    # see if user has right to upload this file type
    if ( ! $wgUser->isAllowed("upload_protected") ) {
      $error = "I'm sorry. Upload of ${ext} files is not allowed.";
      return false;
    }
  }
  # allow upload
  return true;
}

function checkFileExtension( $ext, $list ) {
  if( in_array( strtolower( $ext ), $list ) ) {
    return true;
  }
  return false;
}

?>

Image/Media page not working.

[edit]

Hi. I've MediaWiki 1.6.9 installed, and allowed to upload .tar files. But when I upload the file, it get uploaded correct (with a log and everything), but the Special:Upload page does not change with still the forms, and after a while I re-download automaticaly my file! When I go to the log or to the Gallery of new files, which all work fine, and I click to the link Image:name_of_my_file.tar I download it automatically! No way I can get: Image: and Media: pages, even manually. Interestingly, when I try to re-upload my file, Special:Upload changes correctly to "save or re-upload" buttons. And I save, I have a normal "File uploaded successfuly' message. But still now way I can get Image: and Media: page working. Anyone could help?! Thanks very much. -- Cedric.

Incorrect info re: file too big error

[edit]

I was getting the "This file is bigger than the server is configured to allow." error, which the content of this page indicates is a problem with the hard-coded value in SpecialImports.php. However, I found that changing that value had no effect. Instead, changing the PHP settings as suggested above that did do the trick. I did not see any errors in the log or the error message described in the section about the PHP settings. I did find the answer, but I think the troubleshooting suggestions are a little misleading. We might save someone else some time by correcting this.

File upload and namespaces

[edit]

Is it possible to create a new upload link page which allows files to be uploaded to a new "Namespace" other than just images?

no. -- Duesentrieb 11:10, 14 March 2007 (UTC)Reply

How to upload file to special svn repository ?

[edit]

hello, I would like SVN to manage the version control and storage of uploaded files ... how could I do such a thing ? Thx

Special:Undelete blank page

[edit]

On some servers (safe mode?), restoring a file or going to the SpecialUndelete.php produces a 500 error page?

Solved This is the case in mediawiki 1.10.1

Goto the phase3 and download SpecialUndelete.php (Revision 21989) and SpecialLog.php (Revision 24687)

[edit]

How to fix?

Disable pretty URLs. $wgUsePathInfo = false;

uploading files named with no-alphabet language

[edit]

I have run a mediawiki for private. During my work, I met some problems. If I try to upload a file named with no-alphabet language, for example, korean language, there will be some error message. Can you help me? please. Nichetas 01:06, 29 October 2007 (UTC)Reply

Upload ok, auto thumbnails not visible

[edit]

I enabled Upload on my MediaWiki which seems to work fine. I can upload images. They appear on the image page and can be referenced within articles. But if I try to use a thumb of the image, the image is generated in the filesystem but not visible. I already found out the reason: the thumb is generated with file permissions set to 700. If I chmod the thumb world-readable everything works fine. What do I have to configure to avoid this problem?

I solved my above mentioned problem by myself and am willing to share my solution. I altered the function doTransform() in includes/media/Bitmap.php to look as follows (this code segment starts about row 96):

		if ( $scaler == 'im' ) {
			# use ImageMagick

			$sharpen = '';
			if ( $mimeType == 'image/jpeg' ) {
				$quality = "-quality 80"; // 80%
				# Sharpening, see bug 6193
				if ( ( $physicalWidth + $physicalHeight ) / ( $srcWidth + $srcHeight ) < $wgSharpenReductionThreshold ) {
					$sharpen = "-sharpen " . wfEscapeShellArg( $wgSharpenParameter );
				}
			} elseif ( $mimeType == 'image/png' ) {
				$quality = "-quality 95"; // zlib 9, adaptive filtering
			} else {
				$quality = ''; // default
			}

			# Specify white background color, will be used for transparent images
			# in Internet Explorer/Windows instead of default black.

			# Note, we specify "-size {$physicalWidth}" and NOT "-size {$physicalWidth}x{$physicalHeight}".
			# It seems that ImageMagick has a bug wherein it produces thumbnails of
			# the wrong size in the second case.

			$cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
				" {$quality} -background white -size {$physicalWidth} ".
				wfEscapeShellArg($srcPath) .
				// Coalesce is needed to scale animated GIFs properly (bug 1017).
				' -coalesce ' .
				// For the -resize option a "!" is needed to force exact size,
				// or ImageMagick may decide your ratio is wrong and slice off
				// a pixel.
				" -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
				" -depth 8 $sharpen " .
				wfEscapeShellArg($dstPath) . " 2>&1";
			wfDebug( __METHOD__.": running ImageMagick: $cmd\n");
			wfProfileIn( 'convert' );
			$err = wfShellExec( $cmd, $retval );

			# Change file permission of created thumbnail to be world-readable
			 chmod($dstPath, 0604);

			wfProfileOut( 'convert' );
		} elseif( $scaler == 'custom' ) {

A huge block of code, yes. I've copied it to make sure, everybody finds the correct location. The single change I made is to be found at the 3rd last row reading "chmod($dstPath, 0604);". This will work if your thumbs are created by imageMagic. If your thumbs are created by a custom scaler or gd, you would have to put the chmod command into the appropriate else-block in this function right after the "$err = wfShellExec ..." line.

Image uploads working erratically

[edit]

I'm having an issue with a clean install of 1.15 when uploading images. Images will upload but sometimes when delivered to the file screen I'm dumped out to a blank page. But the file itself will register in the list of files. If attempting to place the file into a page the whole page disappears after it is saved.

Consequently the gallery page is likewise broken.

Sometimes it works fine. The only consistent thing I am able to discern from a file failing to load correctly is that it will not generate any thumbnails for the image in the thumbnail directory. Whether it succeeds of fails seems to be random.

spoonofdeath@hotmail.com

Sporadic "Internal Error" on Upload

[edit]

I have installed 1.15.1 and am trying to get files to upload consistently. I have $wgEnableUploads set to "true", but most of the time I get 'Internal Error: Could not find file "C:\WINDOWS\TEMP\php4A4.tmp".' If I hit F5 a bunch of times, it will finally go through, but there's no rhyme or reason why sometimes I get the error and other times the file will go through.

NON-image/sound uploads

[edit]

Everyone seems to be focussed on images and sound, but a REAL need here is the ability to link from the wiki to files on our file servers (ie [[Media: <full path? etc>]]) and to upload .doc, .rtf and .txt files to our wiki. Has anyone nutted this out yet? Any help would be greatly appreciated. :) bja 00:05, 22 Jan 2010 (UTC)

Some images refusing to thumbnail

[edit]

I've been trying to thumbnail this image, but keep getting an error. What could fix this? Only this image has the issue, by the way.--99.181.164.173 18:42, 8 May 2011 (UTC)Reply

This is not the place to be asking this question. See the images help page on MediaWiki.org, and ask your question there instead. Ajraddatz (Talk) 19:02, 8 May 2011 (UTC)Reply

Can't upload images?

[edit]

what i get is:

Map "......" could not be created 213.193.181.244 12:09, 22 May 2012 (UTC)Reply

File Upload gives "A database query error has occurred. This may indicate a bug in the software." error in MediaWiki

[edit]

I am new to MediaWiki. When i tried to upload an image using the upload option from the tools menu i get this error: "A database query error has occurred. This may indicate a bug in the software."

My LocalSettings.php file:

$wgEnableUploads = true; $wgUseImageMagick = true; $wgImageMagickConvertCommand = "/usr/bin/convert";

As far as i know the "file_uploads = On" in php.ini file. So should i create a table for file uploads ? Please suggest a way to fix the issue?