I am using python to upload a file to ftp server. My code is below
import ftplib
s = ftplib.FTP('123.123.123.123', 'username', 'password')
f = open('filename to upload', 'rb')
s.storbinary('STOR filename', f)
This code gives me an error.
soccet.error: [Errno 111] Connection refused
When I use C#.net to do this task, there is no problem at all. My c# code is below:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(FtpURL + filename);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.KeepAlive = true;
request.UseBinary = true;
request.UsePassive = false;
request.Credentials = new NetworkCredential(username, password);
FileStream fs = File.OpenRead(FullFilePath);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Stream ftpstream = request.GetRequestStream();
ftpstream.Write(buffer, 0, buffer.Length);
ftpstream.Close();
Please help on this urgent issue!