Drag and drop file upload

Blocks ::: block_dndupload
Maintained by DavoDavo Smith
Drag and drop one or more files directly from your desktop into a Moodle course - if you have Moodle 2.3 or above, this functionality is already present
Latest release:
71 sites
7 fans
Current versions available: 2

This Moodle 1.9 / 2.x block allows you to drag files directly from your desktop onto a Moodle course. It should not be installed on a Moodle 2.3 site as it will clash with the built-in drag and drop upload.

It works with recent versions of Mozilla Firefox and Google Chrome, but not with Microsoft Internet Explorer (IE version 10 should have the required functionality). It has been tested with Windows and Linux and should work anywhere that the above browsers run.


  1. Install the block in the usual way
  2. Add the block to a course in the usual way
  3. Turn editing on (in the usual way) - the block does not show if editing is off
  4. Select a few files from your desktop and drag them onto a course section
Note - if it is not working, please check to see if there is a message in the block; it should warn you if your browser does not support the upload, or if you have AJAX course editing switched off.
The most up-to-date version of this module can always be found at: https://github.com/davosmith/moodle-block_dndupload
(I will not always update the version on Moodle.org when there are changes)


Screenshot #0


Davo Smith (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Wed, Sep 5, 2012, 11:39 AM

    //zh_cn <?php

    // This file is part of the Drag and drop upload block for Moodle
    // Moodle is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    // Moodle is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // GNU General Public License for more details.
    // You should have received a copy of the GNU General Public License
    // along with Moodle. If not, see .

    $string['addhere'] = '在这里添加文件';
    $string['addlinkhere'] = '在这里添加链接';
    $string['addwebpagehere'] = '在这里添加网页';
    $string['blockname'] = '文件拖动上传';
    $string['dndworking'] = '通过从本地计算机中拖动文件,文本或者链接到课程相应主题中上传文件';
    $string['filetoolarge'] = '文件太大无法上传';
    $string['nameforlink'] = '链接名称?';
    $string['nameforwebpage'] = '网页名称?';
    $string['noajax'] = 'AJAX 课程编辑功能必须启动';
    $string['nofilereader'] = '您的浏览器不支持此功能';
    $string['nopermission'] = '您没有添加文件到此课程中的权限';
    $string['noscript'] = 'Javascript 必须启动';
    $string['notmoodle23'] = '您的站点是moodle2.3或以上版本,已经具备此项功能,联系管理员删除此功能';
    $string['pluginname'] = '拖动文件上传';
  • Sat, Sep 22, 2012, 7:20 AM
    Hi Davo,

    I just updated the plugin (we are using 2.2.4) and am getting a popup error when I attempt to dnd a file: "A required parameter (type) was missing: undefined"

    This popup error occurs after the upload animation finishes and files are no longer uploading at all. It's doing this for any type of file that I try sad

    Any suggestions? Thanks!
  • Davo
    Sat, Sep 22, 2012, 6:58 PM
    Tony - I've never seen this error. I will see if I can investigate it when I have a chance, however the best advice I can give at the moment is to delete the plugin and upgrade to Moodle 2.3 as that has all the features of this block (and more).
  • Davo
    Sat, Sep 22, 2012, 9:06 PM
    Tony - just to confirm. I've retested the latest version of the block against the latest version of Moodle 2.2 (2.2.5). It worked as expected in all the tests I did - I tried Chrome + Firefox and both an admin and a teacher account. It seems that there is something odd happening on your system, as the drag and drop javascript code certainly sends the 'type' value when it updates the server.
  • Tue, Sep 25, 2012, 1:18 AM
    Thanks for checking - I completely uninstalled the older version and then installed the new version, cleared out the javascript and theme caches (just in case), and tried it and it works! Weird.

    I wish we could upgrade to 2.3 but it's a bit of a drastic change to switch to it during the middle of a semester at my university. Hopefully next Spring or Summer!
  • Andrew
    Fri, Nov 30, 2012, 6:00 PM
    Andrew Andrew- 30 November, 09:59Hi Davo,

    Fantastic plugin. I've tried installing this on the latest version of 2.2.5 and the following error is being returned when dragging an item into a Moodle course: Coding error detected, it must be fixed by a programmer: clean_param() can not process arrays, please use clean_param_array() instead.: undefined

    Do you know what could be causing this? Thanks, Andrew
  • Davo
    Fri, Nov 30, 2012, 6:04 PM
    Andrew, I'm not sure why that error is appearing. Without checking, I'm not aware of any parameters which would produce that error (and I've certainly not seen it myself). I will try and look at it at some point, but my focus is very much on supporting the core functionality in Moodle 2.3+, rather than maintaining the legacy block code.
  • Andrew
    Fri, Nov 30, 2012, 6:29 PM
    Thank you for your quick response Davo. I'm going to explore what could cause this and if I find a fix, I'll post it here.
  • Davo
    Fri, Nov 30, 2012, 6:42 PM
    Andrew - if you find out what is going wrong (or manage to fix it), could you post it up as an issue on https://github.com/davosmith/moodle-block_dndupload (or even a pull request, if you have suitable code changes). It's easier to manage than comments on here.
  • Andrew
    Fri, Nov 30, 2012, 11:49 PM
    Hi Davo, will do. I'm going to post here also though. I've found the problem to be software specific. I have lots of developers tools on my main machine which is causing the problem. Everywhere else, the block is working fine. I'm going through a process of elimination to discover what is preventing the block from working. It would be useful to know for future reference.
  • Andrew
    Sat, Dec 1, 2012, 12:12 AM
    Hi Davo, I've found the solution. It was one of the web developer plugins in Firefox. I'm not sure what setting I unchecked but a re-installation removing all configuration settings and plugins did the trick.
  • Fri, Dec 7, 2012, 6:59 PM
    A great plugin. Please the moodle 2.4 version!
  • Davo
    Fri, Dec 7, 2012, 7:00 PM
    @Antonio - why would I create a 2.4 version of this block? All the functionality of this block has been a standard part of Moodle core since 2.3.
  • Mon, Sep 7, 2015, 11:49 PM
    Really useful
  • Davo
    Tue, Sep 8, 2015, 12:01 AM
    dom, thanks - but unless you're using a really old version of Moodle (2.2 or below), all the functionality is already there in Moodle core (and if you are using a really old Moodle version, then you should really upgrade to avoid all the security flaws that have been fixed since then).
1 2 3 4
Please login to post comments