Forums / Developer / SQLI Import - How to Import file
Nicolas Panau
Tuesday 24 May 2011 2:40:22 am
Hi eZ Community,
I'm using sqliimport to manage content import (great extension btw), but i'm stuck on importing files (or images).I simply don't get how to use $object->fields-> to import my file. Every other content or dataype is OK.
I succeed by using createAndPublish, and by setting ['storage-dir'], but I didn't find a way to set a storage-dir with sqliimport methods (an option in SQLIContent::create ?), and passing the entire path like $object->fields->myfile->'path/to/my/file/file/pdf' didn't work.
Any clue?
Thanks
www.umanit.fr
Jérôme Vieilledent
Tuesday 24 May 2011 5:29:52 am
Hi Nicolas
You need to pass the real path (absolute) on your server, e.g. /var/www/myimagedir/myImage.jpg (same for binary files.
It's easy to get with realpath() PHP function.
Tuesday 24 May 2011 6:42:33 am
Hi Jérôme,
Thanks, it works... can't believe I missed that! I was indeed passing the relative path.
Cheers!