Python, simple FTP upload .txt
<p>I'm really struggling just to get a simple <code>.txt</code> file to upload to a FTP server. I've got a folder on my desktop which contains two files: <code>text.txt</code> and <code>upload_to_ftp.py</code>.</p>

<p>I've tried these:<br>
<a href="http://love-python.blogspot.com.au/2008/02/ftp-file-upload.html" rel="nofollow">FTP file upload</a><br>
<a href="http://stackoverflow.com/questions/12613797/python-script-uploading-files-via-ftp">Python Script Uploading files via FTP</a><br>
But neither seem to work.</p>

<p>I've re-written the code so many times its doing my head in and i keep getting errors such as:</p>

<pre><code>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
</code></pre>

<p>Any help would be great! Thanks in advance.</p>
