Fetch a file and display it using the File API

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

Davo Smith發表於
Number of replies: 0
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 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.