Error uploading a file from a .bat

Come here to discuss FileZilla and FTP in general

Moderator: Project members

Post Reply
Message
Author
diaverso
504 Command not implemented
Posts: 7
Joined: 2019-06-25 17:23
First name: diaverso
Last name: carrasco

Error uploading a file from a .bat

#1 Post by diaverso » 2021-02-22 18:38

Hi I created a .bat file to upload a file directly to a server.

This is the code that I have:

Code: Select all

    @echo off
    echo user usuario> ftpcmd.dat
    echo pass>> ftpcmd.dat
    echo lcd H:\>> ftpcmd.dat
    echo put *.rar>> ftpcmd.dat
    ftp -n -s:ftpcmd.dat IP
    del ftpcmd.dat
It connects to the server perfectly.
Then it says that the connection is being made to upload the file and stays in that step.

"In the ftp of the server put this information:
230 Logged on
PORT 83,54,203,226,196,4
200 Port command successful
STOR diaverso-20210221133120.rar
150 Opening data channel for file upload to server of "/diaverso-20210221133120.rar"
425 Can't open data connection for transfer of "/diaverso-20210221133120.rar"
421 Connection timed out."

With the filezilla client program I can upload the files without any problem.
I attach a video to see the steps.
https://www.youtube.com/watch?v=xPDlI01aQ0Q


I do not understand why the connection is closed ...

User avatar
boco
Contributor
Posts: 25437
Joined: 2006-05-01 03:28
Location: Germany

Re: Error uploading a file from a .bat

#2 Post by boco » 2021-02-22 23:38

Because the sh*tty commandline FTP client from Windows that's often used in batch files does not support the firewall-friendly Passive mode that was introduced decades ago. If you are behind a router, it is completely useless, as it cannot be further configured.

Search the web for "lftp windows" to get an actually decent command line client.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###

Post Reply