Unable to use File Object. Call to a member function getFileID() on a non-object
Permalink
Hi,
I have been creating a custom block and using a file manager in it in the same way as image slider block uses it. I wanted to know is there a way to limit the file type while getting the file to just image and video type?
And after I fetch the files and show them in the view.php file I want to do two different things for video and image file type. I have been using the link
http://documentation.concrete5.org/developers/working-with-files-an...
and my code for fetching the file is:
the second line gives the following error
where as if I am using the following everything is working fine:
Any help will be great.
Thank you
I have been creating a custom block and using a file manager in it in the same way as image slider block uses it. I wanted to know is there a way to limit the file type while getting the file to just image and video type?
And after I fetch the files and show them in the view.php file I want to do two different things for video and image file type. I have been using the link
http://documentation.concrete5.org/developers/working-with-files-an...
and my code for fetching the file is:
the second line gives the following error
Call to a member function getFileID() on a non-object
where as if I am using the following everything is working fine:
$image = Core::make('html/image', array($f)); $tag = $image->getTag();
Any help will be great.
Thank you
In your block form, you can limit the type using the image() and video() form widgets.
http://documentation.concrete5.org/api/class-Concrete.Core.Applicat...
With the error, I would recommend double checking your code. If $f->getFileID() is producing an error, File::getByID() didn't return an object as $f, and should not work with Core::make('html/image', array($f)).