Reputation: 23
I hope you can help me. I have this error in my php code and I cant figure out what do I need to change and where. It is showing that in this line where it in stars.
Here is my code:
private function replaceFile($id, $file, $version) {
global $CFG;
$source = get_record('procedure_log','procedure_id', $id);
$destination = $CFG->dataroot . "/procedures/$id/$version/";
@mkdir($destination, 0777, true);
$dataobject = new stdClass();
$dataobject->id = $this->logId;
$dataobject->file = addslashes($destination . $file['name']);
**copy(var_dump($source.$file['name'], $destination.$file['name'] ));**
}
Upvotes: 1
Views: 1296
Reputation: 9775
$source
is probably object and you can't use it as string (you tried to do it by joining with $file['name']
string using dot). You should select what you want to add to this string.
Upvotes: 1
Reputation: 15593
You function get_record
probably returning the object not a string that your assigning in the variable $source
. You need to check that what is the value of $source
variable by echoing it.
And you will get your exact problem.
Upvotes: 1