I am trying to upload a file server via FTP input.
My code is as follows:
$ date = date ('ymd'); $ File_name = $ date 'Csv'; $ File_location = 'D: /inetpub/wwwroot/website.com/html/assets/'.$ file_name; // Set the original connection $ conn_id = ftp_connect (FTP_HOST, FTP_PORT); // Login with username and password $ login_result = ftp_login ($ conn_id, FTP_USER, FTP_PASS); // Check connection if (($! Conn_id)) || (! $ Login_result)) {echo "FTP connection has failed!"; Go out; } Else {echo "Connect to FTP server"; } $ Upload = ftp_put ($ conn_id, $ file_name, $ file_location, FTP_ASCII); // Check upload status if (! $ Upload) {resonant "FTP upload has failed!"; } Else {resonance "File uploaded"; } // Close the FTP Stream ftp_close ($ conn_id); If I upload the file manually from FileZilla, then it works perfectly. If I use the code above, then it creates an empty file.
Try moving the file with idle mode:
Comments
Post a Comment