protected function copy_page_files($filearea, $itemid, $newitemid, $contextid) {
        $fs = get_file_storage();
        $files = $fs->get_area_files($contextid, 'mod_lesson', $filearea, $itemid);
        foreach ($files as $file) {
            $fieldupdates = array('itemid' => $newitemid);
            $fs->create_file_from_storedfile($fieldupdates, $file);
        }
    }
protected function copy_page_files($filearea, $itemid, $newitemid, $contextid) {
        $fs = get_file_storage();
        $files = $fs->get_area_files($contextid, 'mod_lesson', $filearea, $itemid);
        foreach ($files as $file) {
            $fieldupdates = array('itemid' => $newitemid);
            $fs->create_file_from_storedfile($fieldupdates, $file);
        }
    }
protected function copy_page_files ( $ filearea , $ itemid , $ newitemid , $ contextid ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ contextid , 'mod_lesson' , $ filearea , $ itemid ) ; foreach ( $ files as $ file ) { $ fieldupdates = array ( 'itemid' => $ newitemid ) ; $ fs -> create_file_from_storedfile ( $ fieldupdates , $ file ) ; } }
Copy the files from one page to another.

@param  string $filearea Area that the files are stored.
@param  int $itemid Item ID.
@param  int $newitemid The item ID for the new page.
@param  int $contextid Context ID for this page.
@return void.
Copy the files from one page to another .