• Post Reply Bookmark Topic Watch Topic
  • New Topic

reading an ftp file using URLConnection  RSS feed

san sui
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been able to open an FTP connection
using the URLConnection class - I specify
the host as ftp://<hostname>/<filename>
fileURLCon = (URLConnection)
if ( fileURLCon == null ){
return false;
sizeInBytes = fileURLCon.getContentLength();
The problem is as follows:
On Netscape I am able to get the size of the
file on calling the getContentLength method,
and am able to open a stream and read the
file in.
However, on Internet Explorer the
getContentLength returns a -1 !!
Does anyone know how to get Explorer to download
a ftp url file using URLConnection or any other
It seems to me that the class
com.ms.net.wininet.WininetURLConnection that IE uses has a bug.
btw, I am using IE 5.5
Thanks a lot.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!