WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

iFTPFileSize 300 Error FileOpen Failed

 Keywords: iFtpFileSize 300 Error FileOpen failed IE11 FireWall WInInet FtpOpenFile 


I have written a Winbatch application that logs into an FTP Server and downloads any new Files found on this Server. This system has been working for years, but last week this system stopped working. It still successfully logs onto the FTP server and obtains the list of Files available. It then uses iFTPFileSize to obtain the Size of the file it wants to download but instead of the size being returned I get a 300 Error: FileOpen failed.

I have investigated and found that I get this error if the Windows 7 Firewall is active. With the Firewall switched off the System works perfectly. We have not changed any Firewall Settings but I guess Microsoft may have patched something in a Windows Update?

I have rebuilt the system using the latest version of WinBatch and Extenders and get the same error. I have also checked the application on other computers and they work so the problem does relate to this Computer and the Firewall.

My FTP system has been tested on 10 different machines (nine Windows 7 and one Windows XP) and 8 of the 10 work fine with the Firewall enabled. The two that fail always fail at iFTPFileSize command with the "FileOpen failed" Error. And both work fine with the Firewall Switched off.

Any ideas what Windows 7 Firewall rule or Ports I should open to allow iFTPFileSize to work with the Firewall active?


WinBatch 2014A
Wininet Extender 
Windows 7
IE 11
Other FTP tools like Firefox FTP client and CuteFTP also have problems downloading Files.
Disabling the Firewall works 100% of the time.
WWWBATCH.INI reports: [WWINT44I] LastError=12002 (iFtpFileSize(FtpOpenFile))


The iFtpFindSize function is attempting to open the file in READ mode, using the Wininet Api function FtpOpenFile:

The error code 12002 from the call to FtpOpenFile iwritten to the wwwbatch.ini file indicates: ERROR_INTERNET_TIMEOUT. You might try adding code to your script to increase the timeout using iOptionSet.

control_send_timeout ( FTP Control channel send timeout ) by default is 300000.
control_receive_timeout ( FTP Control channel receive timeout ) by default is 300000.
Notes regarding the firewall: In Passive mode, the FTP server opens a port on its end and tells the FTP client the Port it needs to connect to. On the client end, it creates a new socket, binds it to a local Port and connects to the server's specified Port. Without seeing a trace log from a network packet sniffer, I would guess that the firewall on the client end is possibly blocking the outbound connection. Have you tried and active connection (@FTP) instead?

You might consider adding error handling to capture the error on the faulty machines. For more on error handling check out:

You might also be dealing with this IE11/WinInet bug:

User Reply:

I am still investigating this but I have found if I use iFTPFileExist before the iFTPFileSize command then this appears to report the File does not exist and does not error unlike iFTPFileSize. It does not solve the problem but at least now I know when it will not work.
Article ID:   W17619
Filename:   iFTPFileSize 300 Error FileOpen Failed.txt
File Created: 2017:07:28:12:58:47
Last Updated: 2014:07:18:08:49:39