Manual:$wgUploadPath

From MediaWiki.org
Jump to: navigation, search

Other languages:
English • ‎فارسی • ‎français • ‎日本語 • ‎polski • ‎português do Brasil
Uploads: $wgUploadPath
The path segment of the upload directory.
Introduced in version: pre 1.1.0
Removed in version: still in use
Allowed values: path
Default value: "{$wgScriptPathManual:$wgScriptPath}/images"
"{$wgScriptPathManual:$wgScriptPath}/upload" prior to 1.8.0
(Note: The default value of this variable depends on other variables, such as the values set in Setup.phpManual:Setup.php, after LocalSettings.phpManual:LocalSettings.php is executed)
Other settings: Alphabetical | By function

Details[edit]

The relative path to the upload directory. This is used to construct the URLs for viewing uploaded files.

In most cases this is just the path component, such as "/w/images". If uploaded files are served from a different domain, this can be a fully-qualified URL with hostname, such as "http://upload.wikimedia.org/wikipedia/en".

If the variable contains a local path (without "http://") then it must start with a slash, otherwise it will result in a bad URL. (For example if you set it to "foldername" it will result in files being loaded from "http://www.example.comfoldername" - note the missing slash after ".com")

$wgEnableUploadsManual:$wgEnableUploads is false by default. Also remember to set directory permissions.

To enable permission checks on image files, $wgUploadPath can be pointed to the img_auth.php script ( $wgUploadPath = $wgScriptPath."/img_auth.php"; ) - see Manual:Image AuthorisationManual:Image Authorisation for instructions.

There are other variables which are defined relative to this one. If you redefine this in your LocalSettings.php then all dependent variables including $wgUploadDirectoryManual:$wgUploadDirectory will need redefining also. If both these settings are not coherent the files will be uploaded to a different folder ($wgUploadDirectory) than from where MediaWiki will try to retrieve them for viewing ($wgUploadPath)!
If using $wgUseInstantCommonsManual:$wgUseInstantCommons or $wgForeignFileReposManual:$wgForeignFileRepos with file caching enabled, cached foreign files will be served from $wgUploadPath

See also[edit]