Moodle 1.9.7: Uploading file in assignment admin panel

Moodle 1.9.7: Uploading file in assignment admin panel

by Roberto Aloi -
Number of replies: 0
In Moodle 1.9.7, I need to allow the teacher to upload a file in the admin panel of a brand new assignment plugin.

When overriding the *setup_elements* function in my assignment.class.php, I'm doing something like:

$mform->addElement('file', 'foo', 'Label');
$mform->setHelpButton('foo', array('foo', 'Label', 'assignment/type/my_assignment'));

The form is upload with a nice file picker, but how should I manage the uploaded file? Which function should be overridden? How can I specify the place where I want to upload the file?

There's a complete lack of documentation (mixed to a bit of confusion) in Moodle about this sad

I'm digging into the code to see what's happening behind the stage. In the meantime I thought some of you could have done the same in the past.
Average of ratings: -