Forums / Developer / Adding file in ezpublish

Adding file in ezpublish

Author Message

Michaël Todorovic

Friday 09 January 2009 7:29:14 am

Hello,
I'm new to ezPublish and I would like to allow my users to upload files with FTP (ezpublish webdav isn't as fast as ftp). When a user sends a file to ftp, I would like to publish it in the according folder (like in webdav). The file arrival detection is done with inotify calling a php script (via cli). Which part of ezcomponents/ezpublish should I use ?
I think I should use the part of ezdhtml which does upload but don't know where it is located.

Thank you,
Best regards,
Michaël

Björn [email protected]

Friday 09 January 2009 8:49:13 am

just to throw your attention on this one. i do not knwo if it works. I have never used it.

http://projects.ez.no/ezftp

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Michaël Todorovic

Wednesday 21 January 2009 7:06:56 am

Ok, I have done it with part of ezftp. I tried ezftp extension but it consumes 100% CPU. I use vsftpd with a user chrooted in a special directory (i.e. /var/www/extranet/virtualFtp). In order to put files in the right node, I made a php script updateFtp.php (run by cron) which lists content structure menu and creates directories in /var/www/extranet/virtualFtp. A menu called "Marketing" will create a directory "marketing" in /var/www/extranet/virtualFtp.
Via ftp, a user will send a file in marketing (/var/www/extranet/virtualFtp/marketing). The file will automatically added in Marketing node. In a word, it works like ezpublish webdav. Now I will create a new trigger and workflow to call updateFtp.php when a new node is created in menu. It will avoid cron and its latency : I run the script once a day so if I change something, I have to wait next day or run the script by hand.

I empty FTP files to avoid space waste. If a FTP file is overwritten, the ezpublish file is overwritten too. If I delete a FTP file, ezpublish file is moved to trash. Every day, a script is run to delete permanently 7 days old files. FTP directories can't be deleted thanks to vsftpd configuration (RMD ftp command is forbidden).

This solution is much faster than ez's webdav and it works well for now.