Extension:MsUpload

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
MsUpload
Release status: beta
Msupload version 1.27 with wikieditor.png
Implementation Ajax, API
Description Allows to upload multiple files via the editor including drag & drop
Author(s) Martin Schwindl, Martin Keyler and Felipe Schenone
Latest version 12.0 (2016-02-09)
MediaWiki 1.26+
PHP 5.3+
Database changes No
License GNU General Public License 2.0 or later
Download
Parameters
  • $wgMSU_showAutoCat
  • $wgMSU_checkAutoCat
  • $wgMSU_imgParams
  • $wgMSU_useDragDrop
  • $wgMSU_useMsLinks
Hooks used
EditPage::showEditForm:initial
Translate the MsUpload extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

The MsUpload extension allows users to drag & drop upload multiple files from any mediawiki edit page.

MsUpload allows an editor to:
  • 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.
  • Change the name of the file before uploading.
  • Add files to the current category
  • Add the files into the edit page as a gallery

Installation[edit]

  • Download and place the MsUpload files in a directory called MsUpload in your extensions/ folder.
  • Add the following code to the bottom of your LocalSettings.php file:
wfLoadExtension( 'MsUpload' );
  • Install the WikiEditor extension[1]
  • Enable WikiEditor's "enhanced editing toolbar":
    1. either for all users by adding:
      $wgDefaultUserOptions['usebetatoolbar'] = 1;
      to LocalSettings.php
    2. or each user must do so in Preferences → Editing → Enable enhanced editing toolbar

Yes check.svg Done Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

MediaWiki versions earlier than 1.25 or problems with version 1.27[edit]

See Known issues below.

Configuration[edit]

An editor can embed the files into the editor as a list of MsLinks with Extension:MsLinks.

Extension features[edit]

Below are the special extension features that you can set in your LocalSettings.php :

$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 = 'thumb|none'; // Any image parameter separated by a semicolon. Examples are: {width}px, left, right, center, none, border, frameless, frame, thumb etc etc

Relevant global configuration variables[edit]

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');

Configuration with PdfHandler[edit]

Extension:PdfHandler allows an editor upload PDF files and automatically generates thumbnails and image files.

MsUpload can add images to a page. However, MsUpload does not allow PDFs to be displayed as images. To add images to a page, edit the MsUpload.js file. Search for switch in the file and add the line case 'pdf': to it.

Recent changes[edit]

Animated example of drag and drop
Screenshot of older version without Wikieditor
Version 10.0
  • Code structure and style updated to 2014 standards
  • Bugfixing
Version 9.5.1
  • Bugfixing
Version 9.5
  • Image preview
  • Improved CheckFiles function
  • Bug-fixing ie8
  • File instead of Image for gallery
  • Old sajax functions replaced by $.ajax/$.get
  • Removed function SpecialUpload::ajaxGetExistsWarning replaced by API request
  • Plupload 2.0 implemented
  • Lithuanian language (Vitas Povilaitis)
  • Hebrew language (JNF)
  • French language (Marc MORA)
Version 9.4
  • Drop-Zone can be disabled in LocalSettings
  • An image-thumbnail will be displayed after upload
  • Mediawiki-API for text-insertion is used
  • Clear-all link added (remove all uploaded files from list)
Version 9.3
  • Bug-Fix IE
  • Tested in mw1.20.2
  • Plupload 1.5.5
  • Japanese language (Kouichi Nishizawa)
  • Italian language (teokraba)
  • Spanish language (Hernan Hegykozi)
  • New upload icon

Known issues[edit]

Installing an earlier version of MsUpload[edit]

  • Mediawiki 1.25 and earlier: this extension no longer works.
[No solution]
  • Mediawiki 1.27 does not work with MsUpload 1.27, 1.28, 1.29.

Solution for Mediawiki 1.27:

(1) IMPORTANT If Extension:WikiEditor is enabled in Localsettings.php disable it.

(2) In Localsettings.php add two lines:

require_once "$IP/extensions/MsUpload/MsUpload.php";
#wfLoadExtension( 'MsUpload' );
The MsUpload Version 1.25, showing the green Clone or Download button and the Download Zip drop down menu.

(3) Download and install the 1.25 version of Extension:MsUpload on Github:

On the MsUpload/tree/REL1_25 page:
(a) Click the Clone or Download button
In the drop down menu, select the Download Zip button.
The Zip file mediawiki-extensions-MsUpload-REL1_25 will download to your desktop
(b) Open the Zip file mediawiki-extensions-MsUpload-REL1_25
(c) Download and place the files in the mediawiki-extensions-MsUpload-REL1_25 folder in a directory called MsUpload in your extensions/ folder.

Yes check.svg Done Navigate to Special:Version on your wiki to verify that MsUpload 1.25 is successfully installed.

You should know[edit]

  • 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 verification[edit]

If this appears: "This file did not pass file verification" 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 "pptx" version.

Invalid CSRF token[edit]

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.
Firefox
Open Options, Privacy & Security, Cookies and Site Data, Exceptions, enter e.g. https://yourwiki.domain, Save Changes, logout and login again to the wiki.
Safari
Open Preferences, Privacy, ensure that Cookies and website data is set to allow, logout and login again to the wiki.
...

References[edit]

  1. Note that there is a plan to remove this dependency.

See also[edit]