Jump to content

What happens to the local file if file does not exist in the Ftp server folder


vapanchamukhi

Recommended Posts

In my code, before reading a file from the ftp server i create a file and then i pass the name of that file as a parameter to ftp_get() along with a file name of the remote file, which doesn't exist in the ftp server.My question here is... Does that file, i have created, gets deleted if the file that i am trying to copy does not exist in the ftp server?

Link to comment
Share on other sites

<?phpinclude('./FTPConfig.php');$server_file="ABC1.txt";if (ftp_get($conn_id, $server_file, $server_file, FTP_BINARY)) { echo "Successfully written to $local_file\n";} else { echo "There was a problem\n";}//Delete file after downloading//deleteFile($conn_id,'/webspace/httpdocs/testdest.txt');// close the FTP stream ftp_close($conn_id); ?>Actually i want server file to be copied to my local system. Is it necessary to create a file in local system before copying server file?Please somebody help me coz, whenever i try to copy the ftp file to local system without creating one in local system it is echoing "There was a problem"

Link to comment
Share on other sites

No, it's not necessary to create the file before copying it, and it won't automatically delete anything without you telling it to (unless you're saving temp files).Are you connecting to the FTP server and logging in first? Is that in the include file? You may want to make sure all error messages are enabled:ini_set('display_errors', 1);error_reporting(E_ALL);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...