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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With