General plugins

Drag and drop file upload - new block

 
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Davo
Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I wanted to let everyone know that there is now a new block available for Moodle 2.0+, that allows you to drag files directly from your desktop onto a Moodle course section (where they appear as resources).

This works with recent versions of Firefox or Chrome (and IE10 may work, once it is released).

The official Modules & Plugins database entry is here: http://moodle.org/mod/data/view.php?d=13&rid=4963 (once it has been approved)

You can read some documentation here: http://docs.moodle.org/20/en/Drag_and_drop_upload_block 

or, you can download it from Github: https://github.com/davosmith/moodle-block_dndupload/zipball/master 

Screenshot demonstrating drag & drop upload of files

 

 

 

 
Average of ratings: Useful (7)
Mark McCall
Re: Drag and drop file upload - new block
Group Moodle Course Creator Certificate holdersGroup TestersGroup Translators

Davo,

Awesome block.  However, when I tested on a Mac in Safari I received the expected error message in the block.  But, when I tested on with the latest Firefox and Chrome the block did not show up at all.

I checked all ajax settings.

Is there any chance that this block will work with a Mac? 

 
Average of ratings: -
Picture of John St
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Works fine for me on all Macs I tested on (10.5 -10.6 Macbook pro and mini). Tested with FF and chrome. 

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
With editing switched on, the block should always appear on all browsers. The displayed message will change, depending on whether or not javascript is enabled, the browser supports the necessary functions, or AJAX is enabled, but it will always be there. If you are still having problems displaying the block, please switch on debugging on the server and see if there are any error messages displayed.
 
Average of ratings: -
Picture of Jürg Hoerner
Re: Drag and drop file upload - new block
 

Thank you for this very good block.

Would it be possible to make a drag and drop block for the filepicker. That I can choose a directory and to drag and drop the files in a specified directory?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Adding drag & drop upload to the filepicker should be possible, but it would require some core modifications (I don't expect it can be done as a separate block, like the course upload is). It also requires me to have a bit of spare time to implement, so I'm not going to promise anything in the near future.

 
Average of ratings: -
Picture of Jürg Hoerner
Re: Drag and drop file upload - new block
 

If I upload a file with draga and drop, for each file will be created a folder and a subdirectory. 

Can I change names of the directory?

Can I configure, that all files will be saved in the same directory?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
I'm not quite sure what you mean here. There are no directories our subdirectories created when you drag & drop a file. The only thing created is a resource to hold each of the files you uploaded. If you want something different, then it may well be outside the scope of what I have created.
 
Average of ratings: -
Picture of Sue Holtz
Re: Drag and drop file upload - new block
 

I LOVE this block and am wondering if there is a downside to allowing AJAX (it had not been on before) and with the files not going into the repository. Anyone have any thoughts? It just seems too good to be true.smile

Thanks for making it available.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
Downsides of AJAX are that it may cause some problems, as it is an extra layer of complexity. However, there are lots of people using it now, so hopefully all the bugs have been found! As for issues with skipping the repositories, there should not be a problem, as the code I have written does exactly the same thing as the standard file upload, behind the scenes.
 
Average of ratings: -
Picture of Alexander Bias
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Davo, thank you for this great block!

I created a german translation for this, would be great, if you could include it into the block.

Furthermore, what do you think of writing

    function applicable_formats() {
        return array('course' => true, 'course-category' => false);
    }

instead of

    function applicable_formats() {
        return array('course' => true);
    }

Placing the block on a category page is possible (but not needed) and in my test, I get a "AJAX course editing must be enabled for drag and drop upload to work" error when used on a category page while drag and drop on a course page works flawlessly.

TIA
Alex

 
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Thanks for the German translation - I'll try to pop it in tomorrow, when I've got my main dev computer switched on.

The applicable_formats setting is also much appreciated, it is only meant to work in courses, and I'd assumed (without checking) that only setting 'course' to true, would leave it unavailable in all other situations.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Alexander - I took me slightly longer than hoped, but I've now checked in your German translation and the suggested fix to 'applicable_formats'.

 
Average of ratings: -
Picture of Germán Valero
Re: Drag and drop file upload - new block
Group Documentation writersGroup Particularly helpful MoodlersGroup Plugin developersGroup TestersGroup Translators

Thanks for this extremely smart block. Many teachers are very happy (at my school) because now they have a very easy way to upload contents into their courses.

Might this block be considered for inclusion into Moodle core ?

I did a spanish translation of the english strings inside the block (attached).

Thanks again.

 
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Thanks for the translation - I'll get it added as soon as I can.

I'm currently in the process of seeing if I can get the code integrated into Moodle core, starting with the 'file manager' elements that you see when you post to a forum.

The discussion about that can be found in the forums here:

http://moodle.org/mod/forum/discuss.php?d=187624

and in tracker here:

http://tracker.moodle.org/browse/MDL-22504

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I've added the Spanish translation to the version on GitHub - please let me know if it works OK.

 
Average of ratings: -
Picture of Germán Valero
Re: Drag and drop file upload - new block
Group Documentation writersGroup Particularly helpful MoodlersGroup Plugin developersGroup TestersGroup Translators

Hi Davo,

I have updated the spanish translation of the text strings to the $plugin->version = 2011102100 that I just downloaded today. I am sorry I had not realized earlier that we had an older version installed in the production server.

The updated file is attached.

 
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@German Valero

Sorry, I'd missed this whilst I was on holiday - I've added your updated Spanish translation to github.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

As I had a bit of free time this morning, I thought I'd revisit the drag and drop upload block and see if I could get it working with Moodle 1.9.

It looks like it is all working, so I've released a version here:

https://github.com/davosmith/moodle-block_dndupload/zipball/MOODLE_19_STABLE

Please could I have a couple of people testing it, before I update the M&P database entry to reflect its existence?

Thanks

 
Average of ratings: Useful (1)
Picture of John St
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Tested in FF 5 + 6 and moodle versions 1.95 and 1.9.12 and it installed and worked perfect. Awesome work by the way!

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Thanks for testing it out.

I'm thinking of asking our Moodle admin to install it in our college tomorrow, but I wanted to see if a few other people could try it out before it went on a production site.

 
Average of ratings: -
Picture of John St
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Just an update on this. I can't seem to get the 1.9 version of the block to work with Chrome. The 2.0 version of the block works perfectly with chrome but not the 1.9 version...

I looked at the code a bit and the first problem seems to be that, in Chrome, the block seems to think ajax course editing is turned off (even though it is on). However, even removing this check, Chrome only seems to work partially in the 1.9 version.

If you get a chance to check it out, that would be awesome!

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

The block was primarially developed using Chrome (with Firefox testing afterwards). It is working fine with Moodle 1.9 and Chrome.

To be on the safe side, before making sweeping claims like this, I've just upgraded my Moodle 1.9 test site from 1.9.9+ to 1.9.16+. The block continued to work fine.

There must be something non-standard on your site that is causing problems.

 
Average of ratings: -
Picture of John St
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

You seem to be correct, sorry. I tested on a clean install, 1.9.15 and worked fine... Not sure what is up with my older install.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

Hi Davo

Working for us too. On Moodle 1.9.x, Firefox 6.0.2. On both topics or weekly format courses. Another outstanding job, Davo cool

Thanks!

Geoff

 
Average of ratings: -
Picture of Michael Woods
Re: Drag and drop file upload - new block
Group Core developers

Oh my! This is one of the coolest things I've seen in Moodle for a while. I just keep dragging stuff on to my course, only so I can be amazed - again.

Seriously, keep developing this mod. Your ideas about dragging text on to create labels, or zip files to (optionally) unpack into folder mods are awesome as well.

Thanks,
Michael 

 
Average of ratings: -
Picture of Oliver Webb
Re: Drag and drop file upload - new block
 

Hi,

Thanks for a really useful block, it makes life alot easier. Is it possible to upload folders in this way? I've tried with a normal folder and a zipped folder and had no success - just wonder if it's something I'm doing wrong?

Also - does anyone know how to add the block to every course? I can set it so that any course created from now on gets it, but not any course already created. It's no big deal, I just wondered.

Thanks again,

Ollie

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

The HTML 5 standard (and web browsers) do not, as far as I can tell, support dropping of folders. Only dropping of files is supported.

I'm considering adding a feature that, when you upload a zip file, it asks whether you want to create a folder, a SCORM activity or just make the zip available to download (but I haven't done that yet).

As an aside, I'm also thinking of allowing dragging and dropping of text (e.g. from a wordprocessor or another webpage) to automatically create a webpage resource and the dragging and dropping of a URL (from the browser address bar or just some text that only contains a URL) to automatically create a web link resource. This was just an idea I had this morning, so, until I get back to my main PC, I can't find out if it would actually work.

 
Average of ratings: -
Picture of J C
Re: Drag and drop file upload - new block
 

Davo,

I've been watching this mod and plan to implement it shortly. I just wanted to say thanks and keep up the good work!

- John

 
Average of ratings: -
On camera
Re: Drag and drop file upload - new block
 

Would be great if folder dropping support was available though I understand why that would be insecure. However an option to prompt when a zip was dropped to add as a file or to add as an unzipped folder would be FANTASTIC! smile

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Stephen - unzipping of zip files to make folders is already fully implemented in Moodle 2.3 (no extra block needed).

 
Average of ratings: -
On camera
Re: Drag and drop file upload - new block
 

Wow! I guess I need to install myself a 2.3 instance and then suffer the agony of waiting and waiting and waiting for my 15 live installs to get approval for upgrading.

 
Average of ratings: -
Picture of Brian Lake
Re: Drag and drop file upload - new block
 

I've stumbled on an intermittent problem:

 

When dragging one file, or a dozen, or a hundred, two files are uploaded instead. It uploads the files I want, and a duplicate. Would there be any reason this might happen?

 

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

You are going to need to tell me which web browser and moodle version you are using, before I can answer that question.

 
Average of ratings: Useful (1)
Picture of Brian Lake
Re: Drag and drop file upload - new block
 
Moodle 2.1.1 latest release (not weekly stable) and firefox 6.xx latest public release. I've noticed this on windows 7 only.
 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I've got Windows 7 on a laptop so I've just booted it up and stuck the latest version of Firefox on it. I've also upgraded my test server to latest Moodle 2.1 stable (via git).

I've not been able to reproduce the problem you mentioned - if I drag 1 file, then that 1 file appears; if I do the same with 2 files, then 2 files appear.

 
Average of ratings: -
Picture of Brian Lake
Re: Drag and drop file upload - new block
 

Thanks for trying Davo. I feel bad I haven't done a more through job reproducing the error. Its enrolment period, and I'm doing a BB 9.1 to Moodle 2.11 course migration - ouch. 

If I can't reproduce it in the next couple of weeks, assume the problem is me. smile

 

 

 
Average of ratings: -
Picture of John St
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

I've noticed in the 1.9 version that the mac users are sometimes uploading the hidden .ds_store files when they drag files from a folder... This does not seem to be an issue in the 2.0 version. Not sure if there is a way to prevent this or not. Not a big deal, just an FYI

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Thanks for letting me know - I'll try and filter them out before upload (when I get a spare moment to do so!).

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Just to update - the version on GitHub now ignores '.ds_store' files.

 
Average of ratings: -
Picture of Germán Valero
Re: Drag and drop file upload - new block
Group Documentation writersGroup Particularly helpful MoodlersGroup Plugin developersGroup TestersGroup Translators

We had duplicates and triplicates of file uploads when several teachers added one instance each of the dragndrop block into the same course.

We were showing the teachers what they needed for the module to work; we showed them one course that did not have the block and therefore, did not work. I added the block in the course, and we were delighted it worked; but some teachers decided to add the blockl themselves and we ended with duplicate blocks uploading the files in duplicate.

Would it be possible for the module to check that it has not been installed in duplicate, or to give a warning if that were the case.

Once again, many thanks and eternal gratitude to the developer of this great block.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I'd have to check, but I'm fairly certain I set the block to not allow multiple instances on a course, so there shouldn't be any way to get more than one copy of the block.

Which version are you using 2.x or 1.9?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I've just double-checked on my local test site and I can't add the block to a course more than once (with either the 2.x or 1.9 version).

I suspect that this is a Moodle bug whereby multiple teachers editing the same course at exactly the same time (without a page refresh) can add a block, that should only appear once, more than once. The solution would be to delete the extra copies of the block - the teachers shouldn't be able to add extra copies again in the future.

 
Average of ratings: -
Picture of Germán Valero
Re: Drag and drop file upload - new block
Group Documentation writersGroup Particularly helpful MoodlersGroup Plugin developersGroup TestersGroup Translators

That is exactly what happened in my demonstration with several teachers adding the block simultanously. When we deleted the extra copies of the block, everything went back to normal.

Once again, thanks a lot for this magnificent block. Would it be possible to include it in Moodle core?, so that we didn't need to download/install/update but just show/hide it within Moodle Site administration/plugins/blocks/ manage blocks ?

Many a Moodle administrator would love this scenario.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I'm working on a proposed patch that would add this directly to Moodle core (in a friendly and flexible way). I hope it will get accepted, but I'm not a core developer, so it will depend on someone who is one accepting my patch and merging it in (once I've finished my patch first, of course!).

The patch would remove the need for a block; the code would (ideally) just work on all courses, once enabled.

 
Average of ratings: Useful (2)
Picture of J C
Re: Drag and drop file upload - new block
 

YES!

I found your post by searching for a way to add the Drag and Drop Upload block to the Front Page (without success, it wasn't in the Blocks list on the front page)  for the same reason you mention- I want it available site wide.

I vote yes. I am voting early and will vote often ;)

Additionally, I suggest the capability be extended so images can be drag and drop from a browser, too. You can drag a file link, but it would be helpful to be able to drag an image directly into a course.

- JC

 
Average of ratings: Useful (1)
Pete Astbury
Re: Drag and drop file upload - new block
 

hey, first - great block smile

second - I have just set this up and we have a lot of course in our install.  Do I have to install this on them all one-by-one or can I install on them all at once?  the block doesn't seem to want to be installed on the homepage which means I can't add to all courses the way i do with other blocks.

any thoughts?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I'm planning on pushing out an update that fixes it so it can be a sticky block on the front page (1 line change), but ran into a problem when testing it the other day. However, I've since found that this is an issue with the Moodle 2.2 beta I was using and not my block (I wish I realised it was a core bug earlier, as then I could have reported it as such, as the core dev team only spotted it on Friday).

I'm not on the main dev computer at the moment, so I can't push out the change, but if you want to change it yourself, open up the file 'block_dndupload.php' and change the line 'applicable_formats = array('course' => true, ...' to 'applicable_formats = array('all' => true, ...'

Davo

 
Average of ratings: -
Picture of Dorbor Jallah
Re: Drag and drop file upload - new block
 

I keep getting an error message each time I upload the files to my server and click on notification:

"Block dndupload: self test failed".

I am using Moodle 1.9.10 and Firefox 8.0.1

Please help.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Dorbor

Please confirm you have downloaded the Moodle 1.9 version of this plugin and that you have installed it in the correct folder (blocks/dndupload).

 
Average of ratings: -
Picture of William Mair
Re: Drag and drop file upload - new block
 

Davo,

Does this mean that the block does not currently work with 2.2, or was the core bug been fixed before release?

Thanks

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@William

The core bug was to do with sticky blocks not remembering the page types that they should be appearing on. It should not stop the block from working, but it did stop me testing out the 'sticky block' functionality with it.

 
Average of ratings: -
Picture of Chris Kenniburg
Re: Drag and drop file upload - new block
Group Particularly helpful MoodlersGroup Plugin developers

Hello Davo Smith,

Out of all the plugins and mods I have shown my teachers, Drag and Drop is the one that they are truly appreciative of and like the most.  It is such a time saver and it works the way they do because they feel like they are just transferring files from one place to another. 

Thank you for creating such a nice plugin. 

+1 for allowing drag and drop into other areas as mentioned before.

Thank you,

Chris

 
Average of ratings: -
Picture of Alexandre Marques
Re: Drag and drop file upload - new block
 

Plugin "block/blocksdndupload" is defective or outdated, can not continue, sorry.

Mais informações sobre este erro

Debug info: Missing main block class file.
Stack trace:
  • line 635 of \lib\upgradelib.php: plugin_defective_exception thrown
  • line 273 of \lib\upgradelib.php: call to upgrade_plugins_blocks()
  • line 1466 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 317 of \admin\index.php: call to upgrade_noncore()
I get this today when install to v2.1.1 - Any idea Why ?
Ty in advance
Alex
 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
The block should be installed to: 'block/dndupload'
 
Average of ratings: -
Picture of Alexandre Marques
Re: Drag and drop file upload - new block
 

i am so sorry, i didn't realize the name of the folder. sad that was a shame for me sad

 

Ty for your time man sad

Alex

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I've released a new version with an experimental feature - the ability to drag links and blocks of text onto a course. This is only in the Moodle 2.x version (so far).

Links can be dragged from the address bar of another browser window and will create a link in the course.

Blocks of text can be dragged from a browser window, a wordprocessor, a text editor or any other application, and will create a page containing that text.

These seem to both work fine in Chrome, but the text dragging seems a little tempramental in Firefox (latest edition, running under Ubuntu). This is entirely down to the data provided by the browser, so it's not something I can fix.

Please can I have some volunteers to test this and give some feedback? 

(It can be downloaded via the github link in the first post).

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

Hi Davo

Can confirm this works as follows in latest stable Moodle 2.1.1

Using Firefox 7.0.1 or Chrome 14.0.835.202 can drag and drop links from the address bar, by selecting the favicon to the left of the link.

Selecting and dragging text (from Gedit text editor or LibreOffice Writer) worked consistently with Chrome but not Firefox.

All on Fedora 15 client OS.

Thanks for these new drag-and-drop upload features

Finally, just wanted to restate how incredibly useful we have already found the Drag-and-drop upload block. We have encountered frequent issues migrating courses from Moodle 1.9 to Moodle 2.1.1. and this block has come to the recue by making it simple to add missing resources. If all else fails, it is actually rather quick to, say, bulk-download resources from a Moodle 1.9 course by FTP, then drag-and-drop them onto a new Moodle 2.1.1 course.

Thanks again!

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

Also, seems to have broken the original drag-and-drop upload of files with FireFox. They are now uploaded as text pages.

However, does all work properly with Opera

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
Hmmm... Shouldn't have broken the file upload in Firefox - I'll try it again, when I have a moment.
 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I've checked in an updated version that now allows Firefox to work with files again, but it won't work with creating pages in Ubuntu - seems fine in Windows though.

With Ubuntu & Firefox, dragging the contents of a text file, announces to the browser that the available content types include both 'text' and 'Files'. You get the same result when dragging any type of file (not just the contents). I can't distinguish between the two until I ask for the file (later in the process), only for it to tell me that there aren't any.

It is probably fixable, but not right at this moment (too late in the day!).

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

Thanks for you continued efforts with this.

I can now add files and links with Firefox 7.0.1 on Fedora 15 Linux.

Text works some of the time.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

...and all works flawlessly on Windows XP with Firefox 5, 6 or 7.

Highlighted text successfully drag-and-dropped into a Moodle 2.1.2 Page resource from Word 2003, Word 2010, WordPad, Notepad++, and from another instance of Firefox.

Since most/all of our teachers are on Windows, that's awesome cool

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Drag and drop file upload - new block
Group Plugin developers

Ooops!

That should say...

...does all work properly with Chrome. (Not tested Opera)

 
Average of ratings: -
Picture of michael reynolds
Re: Drag and drop file upload - new block
 

I installed the drag'n' drop block but nothing happens. I checked the course setting to enable ajax and my user settings. The message in the block says 'ajax course editing must be enabled ...' I have enabled it. Slightly frustrated when I see all these post sayingb how great this blockn is. Any ideas how I can get it working?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
Is AJAX *course editing* enabled?

Can you drag and drop activities already in your course, to move them around? (the move icon beside each activity should look like a 4-way arrow, not an up-down arrow).
 
Average of ratings: -
Picture of michael reynolds
Re: Drag and drop file upload - new block
 

yes , I can drag and drop within the course area . I have the slides format and it even allows moving activities between the tabs. I switche to plain topics but still had no luck.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

I wouldn't expect drag & drop upload to work with anything other than the standard weekly or topics format (it might work with some of the others, but it is untested and I won't try to fix it if it doesn't work).

You haven't mentioned which version of Moodle you are using, which makes it difficult for me to suggest anything further.

Assuming you are using Moodle 2.x, the AJAX course editing is all controlled by a file called 'courseajax.js'. This creates an javascript object called 'main', when it starts the AJAX editing process. My drag and drop upload code looks for the 'main' object - if it is there, it carries on working, if it doesn't exist, it gives the error message you described.

I can't think of any way that AJAX could be working on your course and the main object would not be defined.

 
Average of ratings: -
Picture of llywelyn morgan
Re: Drag and drop file upload - new block
 

big huge thanks.  this will make life so much easier for staff.  

only glitch i've noticed is that on uploading a file, the first letter of the filename is deleted.  any reason for this? (moodle 2.1)

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Llywely - Just tested with Firefox and Chrome - no problems with filenames losing characters on my local computer.

I get the filename directly from whatever the browser tells me the file is called, so it sounds like a browser bug to me. As a quick check - does the filename display incorrectly both during and after the upload (during the upload the filename is generated by the javascript, after the upload, the server returns the final filename; so that would help to narrow down the problem a little).

It would also help to know which browser / OS you are using.

(As an aside - I nearly had a panic when I did a quick test of this, as the course suddenly started uploading 2 copies of every file; I then remembered that my 2.1 install is where I'm developing a proposed core patch to allow this functionality across Moodle without needing to add a block - both the 'block' version and the 'core' version were uploading the file for me!)

 
Average of ratings: -
Picture of Lael ...
Re: Drag and drop file upload - new block
 

Davo - first let me say thank you - this block is incredible in terms of increasing the usability of Moodle.

Any chance this proposed patch would allow drag and drop in other areas of Moodle too? (like in a lightbox gallery?) That would be super cool!

 
Average of ratings: -
Picture of llywelyn morgan
Re: Drag and drop file upload - new block
 

Hi Davo

It is happening in Firefox, Chrome and IE.  Now happening on our older Moodle 1.9 installation.  More than likely a server problem as the file name is showing correctly while uploading via drag'n'drop.  Whatever could it be though as this has never happened before!

Llyw

 
Average of ratings: -
Picture of llywelyn morgan
Re: Drag and drop file upload - new block
 

addendum

the problem only occurs in chrome and firefox.  ie is immune from it.

 
Average of ratings: -
Picture of Alexander Bias
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Hi Davo,

we have a Moodle role who is allowed to edit blocks in a course, but isn't allowed to add or edit content in a course. Users with this role are shown the "noajax"-Message in the Drag-and-drop-Block which is quite misleading in this case.

Therefore we thought if you could check for the capability moodle/course:managefiles and display a different error message when this capability isn't set.

See attached file for a basic implementation with english and german messages (which have to be migrated into the language file of course)

Greetings
Alex

 
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Thanks Alexander,

I've tidied up the code you sent a little and published it over at github.

Davo

 
Average of ratings: -
Picture of Alexander Bias
Re: Drag and drop file upload - new block
Group Core developersGroup Plugin developers

Thank you very much!

Alex

 
Average of ratings: -
B.Havel
Re: Drag and drop file upload - new block
Group Particularly helpful MoodlersGroup Translators

Hi,

czech translation is attached.

Bohus

 
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Bohumil Havel:

Thanks for Czech translation, sorry it's taken me a few days to respond, but I've now added it to the github download.

 
Average of ratings: -
Picture of Paul Nijbakker
Re: Drag and drop file upload - new block
Group Particularly helpful Moodlers

Hello Davo,

I wish to encourage you to continue to develop this functionality. In its present form it is already useful. It would be even greater if it could also drop files, etc. inside existing resources.

I have attached translations for Finnish and Dutch (and may add Swedish too when I have time).

Rgrds,
Paul.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Well when Moodle 2.3 comes along, you should be able to drag and drop onto file elements in forms (such as the one you see when replying to forum posts) - which hopefully should make things a little easier.

Thanks for the translations - I'll pop them in place.

 
Average of ratings: -
Picture of Benjamin Steenbock
Re: Drag and drop file upload - new block
 

Hi Davo! Thanks for this excellent mod!

We recently upgraded to a Moodle 2.2.1+ version and we're now seeing that for some reason Windows users using the latest Firefox (9.01) get the little spinning circle but no progress is made actually uploading the file.

Mac users aren't affected and Google Chrome still seems to work.

Is anyone else seeing that issue?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

If one of your firefox users could install Firebug and let me know what javascript error message is produced, then I might be able to do something about it.

 
Average of ratings: -
Picture of Alex Goodyear
Re: Drag and drop file upload - new block
 

Hi Davo, i too am experincing the same issue with the uploader, the constant spining wheel and the upload never completes. If you refresh the page the upload does appear. I have installed firebug and can report the error message is

SON.parse: unexpected character
 
var result = JSON.parse(xhr.responseText);
dndupload.js (line 368)

Hope this is some help and that you can fix it. if there is anything else you need to aid you in fixing this let me knwo

Alex

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
Alex that helps a bit, it means there is something extra & unwanted in the server response. Are you able to look at the firebug network tab and copy the full server response?
 
Average of ratings: -
Picture of Alex Goodyear
Re: Drag and drop file upload - new block
 

 I assume this is what you are looking.

 

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers
Looks like you have the site default for resources set to 'pop-up' and that is expecting the width / height to be set. I guess that it will only take a couple of lines of code to fix, once I have a chance to put the computer on.
 
Average of ratings: -
Picture of Alex Goodyear
Re: Drag and drop file upload - new block
 

This is correct we do have the site defaulting to pop-up. A fix would be much appriciated. If you require any testing just let me know

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Alex - fixed version now on GitHub - https://github.com/davosmith/moodle-block_dndupload/zipball/master 

Let me know if this fixes you problem and I'll roll out onto the Moodle.org plugins page as well.

 
Average of ratings: -
Picture of Alex Goodyear
Re: Drag and drop file upload - new block
 

Thanks Davo, thats fixed it!!

 
Average of ratings: -
Picture of Mihai Bojonca
Re: Drag and drop file upload - new block
Group Testers
Good block, nice idea. Have installed it. Seems to work fine however I have one little problem. The name of the plugin is displayed as pluginname I am new to moodle administration.

 
Average of ratings: -
Picture of Mihai Bojonca
Re: Drag and drop file upload - new block
Group Testers

I have solved it, my bad, forgot to change directory permisions to the moodle one.

 
Average of ratings: -
pi
Re: Drag and drop file upload - new block
 

Hello! I am quite new with moodle administration. I was using the dnd block with moodle with moodle 2.1 and eveything was ok and my teachers were very happy. I recently updated to 2.2.1+ and all of a sudden  dnd doesn't work anymore. Yesterday I upgraded the drag and drop block to the latest version (2.x (Build: 2012012900)).

Unfortunately still the block is not working. I am getting the message : 

AJAX course editing must be enabled for drag and drop upload to work
 
I checked in Appearance->AJAX and JAVASCRIPT and both Enable Ajax and Enable AJAX course editing are enabled (ticked).

Can anyone help me with that??I am having a hard time to convince my teacher using moodle... I need to do things easier for them.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Could you double-check that AJAX is enabled on your user profile page?

If it is, then it requires a bit more debugging. What browser are you using?

 
Average of ratings: -
pi
Re: Drag and drop file upload - new block
 

Hello Davo and thank you for the immediate response. You were correct. Now it is working for the teachers, but not for the admin. Am I doing something wrong? Once again thank you for your help.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

If it is working for teachers, then that implies the site settings are correct. If you have double-checked that the admin's profile is set to allow AJAX, I'm not sure what could be going wrong. 

You haven't mentioned which browser you are using.

Are you able to send me a screenshot of your whole page, showing the error message, as that might give a clue (my email address is in the README for the block).

 
Average of ratings: -
Picture of Meganathan Ramasamy
Re: Drag and drop file upload - new block
 

thanks. It was working fine as drag and drop files. But installing this block we couldn't delete any resources already configured. If you delete the resource, deleted resource will come back again while click turn editing off or refresh the page again. But drag and drop is working fine. After Disable AJAX course editing, the problem solved but drag and drop is not working.

What shall we do?

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Meganathan - my block does not work with AJAX course editing disabled (it could be made to work without it, but my reasoning is that if you have turned off the AJAX course editing, then you should not be using an AJAX-based drag & drop upload feature).

Nothing that my block does should interfere with resource deletion, but, just to be on the safe side, could you remove the block from a course (with AJAX turned on) and see if the resource deletion now works properly? If it does, then my block is involved somehow and will need further investigation. If AJAX resource deletion does not work without my block being present on a course, then you have a problem with the core Moodle code which needs to be raised in tracker.moodle.org

You also haven't mentioned which Moodle version you are using, so it is hard to give further advice.

 
Average of ratings: -
Picture of Ahmed Hamed
Re: Drag and drop file upload - new block
 

How I can make the AJAX is enabled in the user profile page by default

for all users 

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Ahmed - I thought it was on by default.

You haven't mentioned which Moodle version you are using, but you might be able to run a simple SQL query to switch on for all users.

 
Average of ratings: -
Picture of Ahmed Hamed
Re: Drag and drop file upload - new block
 

Thanks for quick response

I'm using moodle V2.1 and the ajax in all profile's by default is no

 

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Ahmed - On a clean install of Moodle 2.1, the 'default' for the 'ajax' field in the 'mdl_user' table is 1 (on). The value is not set in the code during user creation, so it looks like your database has been changed to a different default value.

I suggest you use some sort of database tool (phpmyadmin / adminer) and alter the definition of the 'mdl_user' table 'ajax' field to default to 1 on your server (and, whilst you are at it, you could also use an update query to change all current user 'ajax' values to 1 as well).

 
Average of ratings: -
Picture of Ahmed Hamed
Re: Drag and drop file upload - new block
 

Hello Davo thanks for you continued efforts. The default value of 'ajax' on 'mdl_user' table is 1 on my server ,finally when i upload users with flat file the ajax is on but creating manual users ajax value is off. 

Thanks again for continuing support us and for the great block.

 

 
Average of ratings: -
Picture of Keith Bolstein
Re: Drag and drop file upload - new block
 

I have added this block to Moodle 2.2.  When I am logged in as the site Administrator it works as described.  However, when I assign a teacher to a course they they cannot drag and drop files.  

Any ideas what I need to change so the teachers of the course can use this?

Thanks.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

What does the block say when a teacher is logged in?

If the block is missing, then make sure that editing is on.

If the block says something to do with permissions, then make sure they have 'moodle/course:managefiles'.

If it says something about AJAX, then make sure they have AJAX course editing enabled in their profile.

If it says something about the browser not supporting it, then stop using IE smile

Davo

 
Average of ratings: -
Picture of Keith Bolstein
Re: Drag and drop file upload - new block
 

Thank you for the reply.  I had to go into the prefrences of the user and enable AJAX.

I have a new problem now.  We have setup our Moodle 2.2 site under File Activity Module to "Force Download" only for all documents for "Available display options"

When teachers upload documents this setting works fine and they cannot switch to any other setting.  However, when they use Drag and drop it sets it up for Automatic.  If they change this setting to "Force Download" in Moodle then it is fine but we want all files posted on our courses to have the "Force Download" only.  We do this because our students use iPads and the PDF files posted cannot be opened in other apps if it is embedded.

Any suggestions on how to make all drag and drop files to be set to "Force Download"?

Thanks.

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Assuming you have the latest code, the block respects the site default.

If your site default (not just the available options, but the default) for file resource is 'Force download', then that is the setting that will be used by file resources created by my block (the same is true for url & page resources my block creates).

 
Average of ratings: -
Picture of Keith Bolstein
Re: Drag and drop file upload - new block
 

Do you know where to make this change?  I went into file.php found the following line:

 $forcedownload = optional_param('forcedownload', 0, PARAM_BOOL);

I then changed "0" to "1", restarted Apache to make sure everything took and then tried again but it still went to "Automatic" when I added a file.  Any ideas for the change I need to do?  I'm running Moodle 2.2.  

Thanks again for your help!

 
Average of ratings: -
Picture of Keith Bolstein
Re: Drag and drop file upload - new block
 

I found the setting under "

Default values for activity settings"

We are all set.  Thanks for all your help.  I demonistrated how easy it is now to add content to courses for our teachers and they were very excited.

 
Average of ratings: -
François Lizotte
Re: Drag and drop file upload - new block
Group Particularly helpful Moodlers

Just testing the block on Moodle 2.2.2+ (Build: 20120329).

It works great with Firefox, but I get this error message with Chrome 21.0.1180.89 m on Windows 7.

http://screencast.com/t/xcRUG5JkgBmo

Approx. translation: Required parameter missing

 
Average of ratings: -
François Lizotte
Re: Drag and drop file upload - new block
Group Particularly helpful Moodlers

Update

Two of my colleagues just tested with Chrome and it worked. Sounds like a problem with my own browser. We all have the same version (21.0.1180.89 m). I'll update if I find something.

François

 

 

 

 
Average of ratings: -
François Lizotte
Re: Drag and drop file upload - new block
Group Particularly helpful Moodlers

Update

Problem fixed now with Chrome update to 22.0.1229.94 m

Cheers!

 
Average of ratings: -
Love Skating!
Re: Drag and drop file upload - new block
 

Hi Davo, love the block, works great in IE10 (Win7).  I was wondering if there was a fix for the block to work subpages.  We are using Moodle 2.2, theme - Aerie and OneTopic course format, works great in all aspects except for subpages. Reading the topics above, I also found out about dragging web addresses over to create weblinks - great tool.

Thanks Belinda

 
Average of ratings: -
Davo
Re: Drag and drop file upload - new block
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

@Belinda - as the functionality of the block is now a standard part of Moodle 2.3+, I am no longer making any changes to the block.

You could try testing the subpage module with Moodle 2.3/2.4 and see if drag and drop upload works there. If not, contact the maintainers of the subpage module to see if they can update it to work with drag and drop upload (I have a feeling it might work already, as I tried it out ages ago, but I can't really remember).

 
Average of ratings: -