Release status: beta
|Description||Allows to upload multiple files via the editor including drag & drop|
|Latest version||13.5 (2022-01-15)|
|Compatibility policy||Master maintains backward compatibility.|
|License||GNU General Public License 2.0 or later|
|Translate the MsUpload extension if it is available at translatewiki.net|
|Issues||Open tasks · Report a bug|
The MsUpload extension allows users to upload multiple files by drag & drop in the standard MediaWiki edit page.
- Easily upload one or multiple files simultaneously.
- File upload integrated in the edit page.
- Upload via drag and drop (if HTML5 is available in browser).
- Add the file into the edit page as a link.
- Add the files into the edit page as a gallery.
- Change the name of the file before uploading.
- Add files to the current category, if the page being edited is a category page.
- Install the WikiEditor extension. By default its editing toolbar is enabled for all users.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'MsUpload' );
- Configure as required.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
An editor can embed the files into the editor as a list of MsLinks with Extension:MsLinks.
Below are the special extension features that you can set in your LocalSettings.php along with their default values:
$wgMSU_useDragDrop = true; // Should the drag & drop area be shown? (Not set by default) $wgMSU_showAutoCat = true; // Files uploaded while editing a category page will be added to that category $wgMSU_checkAutoCat = true; // Whether the checkbox for adding a category to a page is checked by default $wgMSU_useMsLinks = false; // Insert links in Extension:MsLinks style? $wgMSU_confirmReplace = true; // Show the "Replace file?" checkbox $wgMSU_imgParams = '400px'; // Default image parameters, for example "thumb|200px" $wgMSU_uploadsize = '100mb'; // Max upload size through MsUpload
Relevant global configuration variablesEdit
Below are some of the relevant global configuration variables that you can set in your LocalSettings.php:
$wgEnableWriteAPI = true; // Enable the API $wgEnableUploads = true; // Enable uploads $wgAllowJavaUploads = true; // Solves problem with Office 2007 and newer files (docx, xlsx, etc.) $wgGroupPermissions['user']['upload'] = true; // Allow regular users to upload files // Make sure that the file types you want to upload are allowed: $wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','pdf','ppt','tiff','bmp','docx','xlsx','pptx');
Inserting PDFs as image thumbnails with PdfHandlerEdit
When processing regular bitmap image types with extensions like
.png, MsUpload will offer you the option of inserting a link to the image (e.g.,
[[:File:Image.jpg]]), or embedding the image in the page itself (e.g.,
MsUpload does not offer this option for files with
[[File:…]] links, just as with other conventional bitmap image types, so it makes sense to have MsUpload treat PDFs just as any other image.
switch ( file.extension ) block which handles this is around line 188 in
extensions/MsUpload/MsUpload.js. Look for the
case 'pdf': clause that handles PDFs (around line 212) and add
file.group = 'image'; so that the
case clause ends up looking like this:
⋮ case 'pdf': file.group = 'image'; file.li.type.addClass( 'pdf' ); break; }
Animated example of drag and drop
Screenshot of older version without WikiEditor
You should knowEdit
- Without HTML5 support Adobe Flash is used.
- The maximum file size depends on MediaWiki settings but a lower limit may be set.
- Uses the plupload upload handler, which comes included with the extension
- Adds an upload icon to the editor and WikiEditor.
This file did not pass file verificationEdit
If the message "This file did not pass file verification" appears, add the following to LocalSettings.php:
$wgAllowJavaUploads = true;
If this is not enough additionally set the following in LocalSettings.php (works for MW 22 & 24):
$wgVerifyMimeType = false;
If you still cannot upload "
ppt" files, try to save them as "
pptx" and upload the "
Invalid CSRF tokenEdit
The Invalid CSRF token message means that your browser couldn't create a secure cookie, or couldn't access that cookie to authorize your login.
- Google Chrome
- Open Settings, Advanced, Privacy and security, Content Settings, Cookies, Allow, Add and enter e.g.
[*.]yourwiki.domain, logout and login again to the wiki.
- Open Options, Privacy & Security, Cookies and Site Data, Exceptions, enter e.g.
https://yourwiki.domain, Save Changes, logout and login again to the wiki.
- Open Preferences, Privacy, ensure that Cookies and website data is set to allow, logout and login again to the wiki.
- Note that there is a plan to remove this dependency.
|This extension is included in the following packages and/or wiki farms:|