Hi
Whats the best approach to overwriting a file from an ftp site with PHP?
I know you cant overwrite a file with fopen, but I dont want to use ftp functions to log in and delete the file because I am using fopen to stream data from a variable into a file, i.e. I'm opening the connection with:
if(!$handle = fopen ($ftphoststring, "wt"){
print "Could not open FTP Site ".$ftphoststring;
exit;
}
and writing with
if (!fwrite($handle, $data)) {
print "Cannot write to file!";
exit;
}
So I guess I need to know
a. How to stream data from a variable to a file on an ftp site using the ftp functions like ftp_nb_put without having to make a local temp file, and handle overwriting/deleting;
or
b. How top query for and delete a file on an ftp site using fopen so I can write a new version
cheers
Whats the best approach to overwriting a file from an ftp site with PHP?
I know you cant overwrite a file with fopen, but I dont want to use ftp functions to log in and delete the file because I am using fopen to stream data from a variable into a file, i.e. I'm opening the connection with:
if(!$handle = fopen ($ftphoststring, "wt"){
print "Could not open FTP Site ".$ftphoststring;
exit;
}
and writing with
if (!fwrite($handle, $data)) {
print "Cannot write to file!";
exit;
}
So I guess I need to know
a. How to stream data from a variable to a file on an ftp site using the ftp functions like ftp_nb_put without having to make a local temp file, and handle overwriting/deleting;
or
b. How top query for and delete a file on an ftp site using fopen so I can write a new version
cheers