Summary: Allow authors to upload files by simply dropping them into the wiki page
Prerequisites: PmWiki 2.2.17, recent browser
Description and Usage
Allow authors to upload files by simply dropping them into the edit or upload form.
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.
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:
$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:
'ULdropzone_innerHTML'=>"Drop files to upload: ",
"Login successful, you can now upload."=>"Login successful, you can now upload.",
- 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.
Recipe written and maintained by Petko. The package includes the Unverse.js library by John Goodman.
See discussion at DragDropMultiUpload-Talk
User notes +12: 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.