Filemanager - Filearea related question

Re: Filemanager - Filearea related question

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
"hs_attachment" is just the name of the form element. It is used to store the draft itemid, which is used to identify the draft area where files are stored whilst the form is being displayed (if the form is saved, the draft area is synchronised back into the real file area).

As per: https://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#Element_preparation

By far the easiest way to use the filemanager element is to make sure it is called "SOMENAME_filemanager" (where SOMENAME is a name of your choosing). That way you can use the file_prepare_standard_filemanager($data, 'SOMENAME', ...) function to copy existing files into the draft area, before you display the form, then call file_postupdate_standard_filemanager($data, 'SOMENAME', ...) function to transfer the files back out of the draft area, once the form has been submitted.
Average of ratings:Useful (1)