This question already has an answer here:
I've created simple HTA-page
<input type="button" value="Run" onclick="run();">
<script>
function run() {
var shell = new ActiveXObject('WScript.Shell');
shell.run('cmd /c ftp -i -s:D:\ftp.bat',0,true);
}
</script>
And on my disk D created ftp.bat
open mydomain.com
username
password
cd /public_html
mput D:\filetobeuploaded.txt
quit
But when I run script on the HTA-page, file is not being uploaded to FTP.
If I run my BAT-file via cmd.exe, I succesfully connect to my FTP, but after mput command I get
500 I won't open a connection to 111.111.111.111 <only to 222.222.222.222>
425 No data connection
where 222.222.222.222 is my IP
As I can understand there are two separate problems:
1. I can't connect with FTP if I use
shell.run('cmd /c ftp -i -s:D:\ftp.bat',0,true);
2. I can't upload a file to FTP (no data connection)