Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

DragDropMultiUpload

Summary: Allow authors to upload files by simply dropping them into the wiki page
Version: 20120813
Prerequisites: PmWiki 2.2.17, recent browser
Status: Beta
Maintainer: Petko
Users: +14 (view / edit)
License: GPL3+ (DragDropMultiUpload), MIT (unverse.js)

Description and Usage

Allow authors to upload files by simply dropping them into the edit or upload form.

Screenshot of the Drag & drop multiple file uploader
Screenshot: from 5 files dropped, 2 already uploaded, 1 currently uploading and 2 refused/failed.


The recipe enables multiple asynchronous uploads. Authors can pick files from their file managers and drop them into the wiki page (edit or upload form). They can drop single or multiple files at once, and start again.

  • Before uploading, files that are too large or with unacceptable extensions will be discarded.
  • The files will be immediately and parallelly uploaded to the wiki, without the author having to press a button, leave the edit form or to reload the page.
  • The upload progress is shown, with files already uploaded, currently uploading or failed.
  • After a successful upload, a link allows the insertion of the Attach:File.jpg markup into the wiki edit area, exactly like the buttons of the edit toolbar.
    • If PmWiki renamed the file to a new name, for example lowercase extension, clicking on the link will insert the new filename in the page.
  • After a failed upload, a tooltip title on the filename shows the reason for the failure.

Installation

Get ddmu.zipΔ (alt. download: ddmu.zip):

  • copy the file "ddmu.php" to your pmwiki/cookbook directory
  • copy the folder "ddmu" to your pmwiki/pub directory
  • add to config.php such a line: include_once("$FarmD/cookbook/ddmu.php");

Configuration

  • $DDMUEnableDropzone = 1; # Enable drop zone. The default DDMU uses the whole page as a drop zone. With this line, you can use only the file list as a drop zone. This allows drag and drop of text in the edit area which otherwise is blocked.
  • $DDMUEnableQueue = 1; # Enable upload queue. The default DDMU uploads all dropped files in parallel, which may in some cases break the RecentUploads recipe. With this line, all files are uploaded one after another.

For an international wiki, the following strings can be translated:

  'ULuploading'=>"uploading...", 
  'ULunknown_error'=>"unknown error",
  'ULdropzone_innerHTML'=>"Drop files to upload: ",
  "Login successful, you can now upload."=>"Login successful, you can now upload.",

Notes

  • A recent browser with JavaScript enabled is required. The browser needs to support FormData() objects. Currently:
    • Firefox 4 and newer, Chromium/Google Chrome, Midori, Safari work.
    • Microsoft Internet Explorer version 10 works. Earlier MSIE versions do not.
    • Opera version 12 kind of works (if many files are dropped at once, only one of them is uploaded, but you can drop single files as many times as needed).
  • To upload files, authors need "upload" permissions, if they don't have them, the uploads will fail. Clicking on the failed filename will bring up a login form, allowing the authors to enter their passwords.

Change log / Release notes

  • 20120813 Corrected $RecipeInfo tag to work with RecipeCheck, suggested by Antony Templier.
  • 20120725 Added $DDMUEnableQueue.
  • 20120313a The icons next to the file links are now preloaded and cached.
  • 20110826, 20110826a Added $DDMUEnableDropzone.
  • 20110820 Enabled login form if no upload permissions. Minor style changes.
  • 20110819 First public release, ready to be tested.

See also

Cookbook /
FileAttachList  Adds a Ajax list of quickly attachable files to the edit page (Stable)
MultiUpload  Upload multiple files at once by packing them in a zip archive & extracting them on the server (beta)
UploadForm  Alternative file upload form using (:input file:) (stable)
PmWiki /
UploadsAdmin  Administration of PmWiki uploads

Contributors

Recipe written and maintained by Petko. The package includes the Unverse.js library by John Goodman.

Comments

See discussion at DragDropMultiUpload-Talk

User notes +14: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on July 18, 2014, at 02:55 AM