ftp is uploading file but 0kb file size or data 1

ftp is uploading file but 0kb file size or data

If when using ftp_put you get the one of the following errors:

Warning: ftp_put() [function.ftp-put]: Opening ASCII mode data connection

Warning: ftp_put() [function.ftp-put]: Opening BINARY mode data connection

and it creates the file in the correct location but is a 0kb file and all FTP commands thereafter fail. It is likely that the client is behind a firewall. To rectify this use:



Before executing any put commands. Took me so long to figure this out I actually cheered when I did 😀

Here is what the above code is Doing:
1. Connect to the FTP server
2. Login to the FTP server
3. Change the directory to the one you want to upload the file to
4. Upload the file
5. Close the FTP connection

Similar Posts