I'm really struggling just to get a simple .txt
file to upload to a FTP server. I've got a folder on my desktop which contains two files: text.txt
and upload_to_ftp.py
.
I've tried these:
FTP file upload
Python Script Uploading files via FTP
But neither seem to work.
I've re-written the code so many times its doing my head in and i keep getting errors such as:
sftp = ftplib.FTP('REMOTEFTPSITE.com', 'MYUSERNAME', 'MYPASSWORD')
File "C:\Python27\lib\ftplib.py", line 117, in __init__
self.connect(host)
File "C:\Python27\lib\ftplib.py", line 135, in connect
self.welcome = self.getresp()
File "C:\Python27\lib\ftplib.py", line 210, in getresp
resp = self.getmultiline()
File "C:\Python27\lib\ftplib.py", line 196, in getmultiline
line = self.getline()
File "C:\Python27\lib\ftplib.py", line 183, in getline
line = self.file.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
Any help would be great! Thanks in advance.