General developer forum

Fetch a file and display it using the File API

 
Davo
Re: Fetch a file and display it using the File API
Core developersParticularly helpful MoodlersPlugin 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.


 
Average of ratings: -