clement clement - 3 years ago 88
PHP Question

know if a file exist through FTP in php

I'm asking how know if a file already exist in a FTP in PHP.

For example I upload a file like that :

$ftp = ftp_connect(...;

But I have error chen I copy a file that already exist (so I have to rename the newest file to upload it correctly :-) )

So how to do to know if there is already a file named as the one I upload?

Answer Source

Before you upload, use the ftp_size function to see if there is a file.
If it returns anything that is not -1, then the file exists.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download