title: Getting "Could not open data connection to port xxxx" when uploading file to FTP from Windows batch file
body: <p>I am trying to upload a text file to FTP server using a batch file. It logins successfully and shows</p>
  
  <blockquote>
    <p>Port command sent successfully</p>
  </blockquote>
  
  <p>but after that shows</p>
  
  <blockquote>
    <p>Could not open data connection to port xxxx<br>
    Connection timed out</p>
  </blockquote>
  
  <p>This is the batch script:</p>
  
  <pre><code>@echo off
  
  for %%A in (*.csv) do set latest=%%A 
  echo Latest file is %latest%  
  
  echo MYUSERNAME&gt; upload.txt 
  echo MYPASSWORD&gt;&gt; upload.txt 
  echo asc&gt;&gt;upload.txt 
  echo put %latest% s.txt&gt;&gt; upload.txt 
  echo quit &gt;&gt; upload.txt  
  
  ftp -s:upload.txt server58.hostinger.in
  </code></pre>