• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading from an FTP URL

 
san sui
Greenhorn
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)
fileURL.openConnection();
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 file using ftp...
Thanks a lot.
 
Van Glass
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure exactly how to do this with IE. Typically the way to get the filesize for a remote file on a Ftp server is to parse out the information returned when getting a directory listing OR to use the SIZE [filename] Ftp command. I imagine it is working in Netscape probably because Netscape is handling their I/O streams differently than in IE.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!