Uploading files direct from the resource form

Uploading files direct from the resource form

by Mad Alex -
Number of replies: 4
It is a pain to have to go to the file manager to upload a file when one has got all the way to the list of file when adding an uploaded file resource.

Hence I have implemented an upload control directly on the form. This allows one to upload a file (to the root directory for the course) and have it used for the resource.

I have also remove another annoyance. One no longer is forced to enter a summary.

Also the code used to allow one to post empty resources even when this meant that the resource was broken (eg. one could not choose any file from the list for the uploaded file type and then the file would not be found naturally). I have fixed this.

In to the bargin I have made most of the html xml compliant. Little at a time and it will get there!

I applied the changes to the latest copy of the code from CVS so I hope things haven't changed to much.

The files which have changed are contained in the attahed archive which should be extracted in the moodle directory.
Average of ratings: -
In reply to Mad Alex

Re: Uploading files direct from the resource form

by Art Lader -
Installed it on a version 1.1 site... Worked like a charm. Thanks!
In reply to Mad Alex

Re: Uploading files direct from the resource form

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hey, thanks, Alex ... I tried it and it works fine.

I really hate to be a party pooper and the last thing I want to do is dissuade you, but I was really hoping to implement this differently - in a way that could be reused in different areas.

The idea is to have a popup window on that page that basically contains the normal file manager in it (including upload, unzipping etc), except all the files have "select" next to them. Selecting a file from there would close the window and update the resource screen appropriately.

This "new" file manager should be encapsulated in a class so this functionality can be added in different places though Moodle as a consistent file-selection mechanism ...

Overall the strategy is to centralise the file handling so that we can add support for databases, for safe-mode servers etc ...
In reply to Martin Dougiamas

Re: Uploading files direct from the resource form

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Please see: http://moodle.org/mod/forum/discuss.php?d=2126#12883 which implements a similar thing for images in the richtext editor ... the same idea just needs to be modified for uploaded resources.
In reply to Martin Dougiamas

Re: Uploading files direct from the resource form

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I was in the area this evening and did this - see the latest CVSsmile