Page 1 of 1

automatically add txt files into server folders

Posted: Sat Aug 22, 2009 2:26 am
by aneuryzma
hi,

I would like to know if it is possible to automatically create an empty txt file on the server when a new picture is added.

For example:

picture1.jpg is added (through ftp, or through back-end of my content mangament system)

the server "produces" the picture1.txt file

Similarly, whwn you remove picture1.jpg, also the picture1.txt file is gone.

thanks

Re: automatically add txt files into server folders

Posted: Sat Aug 22, 2009 2:47 am
by VladSun
Yes, it's possible.

Re: automatically add txt files into server folders

Posted: Sat Aug 22, 2009 3:01 am
by aneuryzma
thanks!

How can I do it ?

Re: automatically add txt files into server folders

Posted: Sat Aug 22, 2009 3:12 am
by VladSun

Re: automatically add txt files into server folders

Posted: Sat Aug 22, 2009 3:36 am
by aneuryzma
thanks, one more question:

how can I detect when a file is uploaded or added to a specific folder ?

I need it working if I use ftp or back-end as well.

thanks

Re: automatically add txt files into server folders

Posted: Sat Aug 22, 2009 8:59 am
by VladSun
When the file is uploaded via HTTP file upload form you should create (using the same PHP script) the TXT file at the time file has been uploaded successfully.
FTP uploads ... Some of the FTP servers have abilities to run user defined scripts on file upload/download.
Another approach would be to create a cron job (scheduled task) which periodically checks for new files.