This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • 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 that IE uses has a bug.
btw, I am using IE 5.5
Thanks a lot.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!