This used to work (edited code to only show the relevent part):
$newpage = new Page(); $path=$newpage->images->path; $relpath=$newpage->images->url;
Then I save the page with the correct fields filled in. Then I upload the file:
$name = strtolower($sanitizer->name($_FILES['upload']['name']));
$file = $path . $name;
if(move_uploaded_file($_FILES['upload']['tmp_name'], $file)) {
// add it to the page
$newpage->report_request->add($file);
/// save the page
$newpage->save();
}
But now $path and $relpath don't return anything. I get the error "Notice: Trying to get property of non-object" which I think refers to images->path and images->url
I've tried files->path and files->url (in some of the sample code from these forums I picked up that possibility), but that doesn't work either.
How do I access the filesystem path and the url path, both to upload the file and to refer to it?
Thank you,
Jamie












