Fetch a file and display it using the File API

Re: Fetch a file and display it using the File API

napisao/la Davo Smith -
Broj odgovora: 0
Slika Core developers Slika Particularly helpful Moodlers Slika Peer reviewers Slika Plugin developers

You need to make sure you're using the file_prepare_standard_editor() and file_postupdate_standard_editor() functions ( https://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#editor ) to a) copy files in and out of the draft area when entering / exiting the form and b) rewrite all URLs embedded in the form text data to/from the draftfile.php versions.

Any of the core forms that allow file uploads in the editor do this, so there are lots of examples throughout the standard Moodle code.