Copy file from one location to another in moodledata

Re: Copy file from one location to another in moodledata

by Raymond Mlambo -
Number of replies: 0

Hi Paul, sorry, I got it this time.

I changed the code a bit to include the filename, after specifying the new directory where I want the file to be copied to. After adding the filename to it, it worked beautifully!! New line of code now:

($file->copy_content_to($CFG->dataroot . '/peerassessments/' . $peerassessment->id . '/' . $student->id.'/'.$file->get_filename())

Thank you for the help!