writing to a file using php ftp -
i'm exporting data, making file , writing data file...
my file appears on ftp server, it's empty...
here code.
//connect ftp server $ftpstream = @ftp_connect('localhost'); //login ftp server $login = @ftp_login($ftpstream, 'some_login', 'some_password'); if($login) { //we connected ftp server. //create temporary file $temp = tmpfile(); //upload temporary file server @ftp_fput($ftpstream, '/httpdocs/itineraryschedule.txt', $temp, ftp_ascii); //make file writable ftp_site($ftpstream,"chmod 0777 /httpdocs/itineraryschedule.txt"); //write file $fp = fopen('var/www/vhosts/cruiseandmaritime.com/httpdocs/itineraryschedule.txt', 'w'); fputs($fp, 'some data'); fclose($fp); //make file writable owner ftp_site($ftpstream,"chmod 0644 /httpdocs/itineraryschedule.txt"); }
i'm puzzled !
rich :)
get rid of @ see if errors occur
also path
$fp = fopen('var/www/vhosts/cruiseandmaritime.com/httpdocs/itineraryschedule.txt', 'w');
seems little off
$fp = fopen('/var/www/vhosts/cruiseandmaritime.com/httpdocs/itineraryschedule.txt', 'w');
maybe?
Comments
Post a Comment