Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Reading from an FTP URL

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic