Topic on Project:Support desk

Unable to display file in Mediawiki

8
Adba.swht (talkcontribs)

Hello everybody who wants to help me asap.

I got a problem with displaying uploaded files (I am using Mediawiki). I know where the problem is but I don't know how to fix it.

Problem: Mediawiki stores uploaded files to the root insted of using a dedicated folder for some reason.

Well, I noticed that I am able to upload files properly but to the wrong location - all uploaded files are stored in root (C:\e, C:\n etc.) and I do not know why. However, I obviously need them in C:\inetpub\wwwroot\mediawiki\images where the mediawiki is taking them from and where the .htaccess file is located.

Uploaded files normally appear in Mediawiki, however without thumbnails, and when I want to show/display the full file (picture) this page appears:

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information

Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://intranet:82/6/60/Something.jpg
Physical Path C:\inetpub\wwwroot\mediawiki\6\60\Something.jpg
Logon Method Anonymous
Logon User Anonymous

** I tried to copy all folders with files from root to the default location but it isn't working.

** I am using IIS7 on Windows Server 2008

** I have the upload function enabled. I changed this after installation: $wgScriptPath = "/mediawiki"; to $wgScriptPath = "";

Ciencia Al Poder (talkcontribs)
Adba.swht (talkcontribs)

I've already had it configured like this:

$wgUploadDirectory = "$IP/images";

Ciencia Al Poder (talkcontribs)

Oh, right, the problem should be $wgUploadPath then (the URL MediaWiki think the files are accessible from the web). It should be right already, except if you have weird things in $wgScriptPath.

Adba.swht (talkcontribs)

Well, maybe i confused you a little but the "code" below was the first thing I add to LocalSettings.php:

$wgUploadDirectory = "$IP/images";

$wgUploadPath = "$wgScriptPath/images";

BUT I had a problem with uploading from the beginning so I add this (and it solved uploading issue - I can upload now, but they are not able to display properly) Maybe there is some problem but I cannot see it:

$wgFileBackends[] = array(

        'name'        => 'local-backend',

        'class'       => 'FSFileBackend',

        'lockManager' => 'nullLockManager',

        'containerPaths' => array(

                'local-public'  => "{$wgUploadDirectory}",

                'local-thumb'   => "{$wgUploadDirectory}/thumb",

                'local-transcoded' => "{$wgUploadDirectory}/transcoded",

                'local-deleted' => $wgDeletedDirectory,

                'local-temp'    => "{$wgUploadDirectory}/temp",

        ),

        'fileMode'    => 0644,

);

// Define a standard file repository that uses the local backend defined before

$wgLocalFileRepo = array (

        'class'             => 'LocalRepo',

        'name'              => 'local',

        'directory'         => $wgUploadDirectory,

        'scriptDirUrl'      => $wgScriptPath,

        'scriptExtension'   => $wgScriptExtension,

        'url'               => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,

        'hashLevels'        => $wgHashedUploadDirectory ? 2 : 0,

        'thumbScriptUrl'    => $wgThumbnailScriptPath,

        'transformVia404'   => !$wgGenerateThumbnailOnParse,

        'deletedDir'        => $wgDeletedDirectory,

        'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0,

        'backend'           => 'local-backend',

);

Adba.swht (talkcontribs)

And now MSUpload says: Unknown error: "directorycreateerror"

What the hell is going on?

I have the same configuration on my test wiki and works fine.

Only one difference is that my test wiki runs on XAMPP and my non-test wiki runs on IIS. So what is the problem?

Ciencia Al Poder (talkcontribs)

You should probably comment out the definition of $wgFileBackends and $wgLocalFileRepo. I suggested that long time ago because people were getting errors about unable to get lock for uploading files, but that was never the correct way to solve that, because all problems were because of permissions, either filesystem permissions, SELinux problem, or other misconfigurations like temp directories not writable.

Adba.swht (talkcontribs)

I removed it and it works fine now. Thank you.

But I am still a little confused because it didn't work yesterday with the came configuration and now it's OK.