Reputation: 1319
I've tried everything I found in Google results about
200 PORT command successful
but nothing has helped.
Can anyone assist to solve this issue please?
The code of "runScript.bat:
ftp -s:"C:\automation\fileup.bat" myserver.com
The code of "fileup.bat:
username
password
ascii
cd "/public_html/reports/"
lcd "C:\automation\tests\HtmlReporter"
prompt
mput *
disconnect
close
bye
The console log:
C:\automation>ftp -s:"C:\automation\fileup.bat" myserver.com
Connected to myserver.com.
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 7 of 500 allowed.
220-Local time is now 04:40. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
User (server26.000webhost.com:(none)):
331 User username OK. Password required
230-OK. Current restricted directory is /
230-449 files used (4%) - authorized: 10000 files
230 16742 Kbytes used (1%) - authorized: 1536000 Kb
ftp> ascii
200 TYPE is now ASCII
ftp> cd "/public_html/reports/"
250 OK. Current directory is /public_html/reports
ftp> lcd "C:\automation\tests\HtmlReporter"
Local directory now C:\automation\tests\HtmlReporter.
ftp> prompt
Interactive mode Off .
ftp> mput *
200 PORT command successful
Upvotes: 13
Views: 45859
Reputation: 202292
This looks like a typical problem with the FTP active mode. The server cannot connect back to your machine to establish a data transfer connection.
That typically happens as nowadays most client machines are behind a firewall or NAT or both, what prevents the FTP active mode from working. To make the active mode working you need to open your firewall (not recommended) and/or configure NAT routing rules.
See my article on FTP modes and configuring network for the active mode.
Or you use the passive FTP mode. The Windows ftp.exe
client does not support the passive mode though, what makes it pretty useless nowadays.
So you need to use another command-line FTP client. A majority of FTP clients do support the passive mode.
For example with WinSCP your runScript.bat
would be like:
winscp.com /command ^
"open ftp://username:[email protected]/" ^
"cd /public_html/reports/" ^
"lcd C:\automation\tests\HtmlReporter" ^
"put *" ^
"exit"
Note that WinSCP defaults to the passive mode.
For details see WinSCP guides for:
(I'm the author of WinSCP)
Upvotes: 26
Reputation: 17
I had exactly the same problem ("200 PORT command successful" stuck on the screen forever), and I was able to solve it.
First of all, there are lot of posts on the Internet saying that Windows ftp.exe doesn't support passive mode. This is not true:
ftp> quote pasv
227 Entering Passive Mode
In my case I had a Windows 2012 R2 server with a real IP. Switching to the passive mode didn't solve the problem, I was still stuck at "200 PORT command successful". At the same time WinSCP worked fine. The solution was to create an inbound firewall rule which allowed external connections from FTP server to the local ftp.exe.
Upvotes: -1