Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write a program to download program  RSS feed

 
Vishnu Murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • 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
 
Marilyn de Queiroz
Sheriff
Posts: 9080
12
  • Mark post as helpful
  • send pies
  • 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.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with Java. I am moving it to the HTML forum.
 
Randall Twede
Ranch Hand
Posts: 4680
8
Java Scala
  • Mark post as helpful
  • send pies
  • 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: 4680
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or you could use a script to send them as .txt but im not sure exactly how.
 
Shriram Shivakumar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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
  • 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: 4680
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my bad. i didnt even notice it was ftp not http. hopefully someone knows a script to help you.
 
lenin laker
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This was posted orginally in Feb 2002, you do not need to answer posts that far in the past....
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!