Creating a file using FTP
Posted: Wed Aug 13, 2008 11:06 pm
I'm trying to create a page using ftp...
It isn't throwing any errors but it isn't creating the file... originally I was using the tmpfile() function to create the temporary file but I tried another method which doesn't work either...
Code: Select all
$content = "Enter your html here...";
$ftpstream = @ftp_connect($ftp_server);
$login = @ftp_login($ftpstream, $ftp_user_name, $ftp_user_pass);
if($login) {
//$temp = tmpfile();
$temp = fopen('php://temp', 'r+');
fwrite($temp, $content);
rewind($temp);
@ftp_fput($ftpstream, $dirpath, $temp, FTP_BINARY);
} else {
echo 'Can\t connect to ftp';
}
ftp_close($ftpstream);