• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to write a program to download program

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
now i am developing official web site for our company, we have some exefiles, textfiles on the net, we want to provide some hyperlink to download these file from the net, how to achieve it. i tried with
<a href=ftp://servername/filename.txt>download</a>
but it is not working, can any one help me as how to achive it.
thanking you
vishnu
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vishnu murthy:
i tried with
<a href=ftp://servername/filename.txt>download</a>
but it is not working, can any one help me as how to achive it.


<a href=http://servername/filename.txt>download</a>
will work if it is a zip file. If you use this with a txt file, the client will see the txt file displayed. They could cut and paste or they could right click on the link and use saveTargetAs

Just some ideas.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has nothing to do with Java. I am moving it to the HTML forum.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the server will display files it can but with file extensions it cant display it will think you want to download the file. this is convenient. the .exe files should download. my only suggestion for the .txt files is to either zip them or use another extension(like .doc)
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
or you could use a script to send them as .txt but im not sure exactly how.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vishnu,
Instead of using ftp in your anchor tag, use http.

Originally posted by vishnu murthy:
Hi all,
now i am developing official web site for our company, we have some exefiles, textfiles on the net, we want to provide some hyperlink to download these file from the net, how to achieve it. i tried with
<a href=ftp://servername/filename.txt>download</a>
but it is not working, can any one help me as how to achive it.
thanking you
vishnu

 
Vishnu Murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Siva kumar,
i tried with http://.... it is giving me the DNS error, i am not getting any results.
vishnu
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my bad. i didnt even notice it was ftp not http. hopefully someone knows a script to help you.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vishnu,
Yes you can do this..
if you have php enabled in your server.
write a php script for downloading the file. Like.
header("Content-disposition: filename=".basename($file));
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");

readfile("$file");
exit();

and $file is the file path for ur file.
I think this will work for you..
with regards,
lenin
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This was posted orginally in Feb 2002, you do not need to answer posts that far in the past....
reply
    Bookmark Topic Watch Topic
  • New Topic