473,231 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

download and display links

I have a txt file in my server.
I have to provide to the user 2 links.
One link is to download the file and the other one is to display it inside
the browser.
Is it possible?
I made <a href="file.txt">Download the file</a> but it display it, and it
does not
ask me to download it.
(of course I could download it by clicking the right button,
but my boss doesn't want that: he wants 2 different links).

Jul 17 '05 #1
3 1833
ti***********@nospam.it wrote:
I have a txt file in my server.
I have to provide to the user 2 links.
One link is to download the file and the other one is to display it inside the browser.
Is it possible?

http://cvs.sourceforge.net/viewcvs.p...18&view=markup

Search for download in that page. Also, please refer manual
<http://in2.php.net/header>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #2
An anonymous being wrote:
I have a txt file in my server.
I have to provide to the user 2 links.
One link is to download the file and the other one is to display it inside
the browser.
Is it possible?
As Michael said, not reliably. The WWW doesn't work that
way. You the publisher hold little sway over how a user
handles your resource.

The ratified way of suggesting presentational information is
through the Content-Dispostion header. The disposition type
'attachment' indicates that the presentation of the resource
should not be automatic. That's a 'should not', not 'must
not'; so even software that honours RFC2183 may, under
certain circumstances, present the resource automatically.

Besides, note carefully the wording of RFC2183:

| Bodyparts can be designated `attachment' to indicate that
| they are separate from the main body of the mail message,
| and that their display should not be automatic, but
| contingent upon some further action of the user.

http://www.ietf.org/rfc/rfc2183.txt

Nothing there requires that the resource be saved to disk.

Content-Disposition, though mentioned in sec. 19.5.1, is not
a part of HTTP1.1, so there's no obligation for browsers to
support it. To me, it's a step in the wrong direction for
the web, and I'd dismiss it straight off. Description not
prescription.

The other, more common mistake is to claim that the resource
is something that it isn't by sending a misleading Content-
Type header. Resources are often sent as application/octet-
stream, which means 'arbitrary binary data'. If there's a
more appropriate type, it should be used instead. A plain
text resource, for example, should be labelled text/plain.
I made <a href="file.txt">Download the file</a>
That should set alarm bells ringing: verbs are out of place
in link text. A link itself doesn't do anything; it is
simply a relationship or connection, as the HTML spec puts
it. With that in mind, how would you set apart your
download link now?

http://www.w3.org/Provider/Style/NoMechanics
but it display it, and it does not ask me to download it.
Because that's how your browser is configured to handle
resources of that type.
(of course I could download it by clicking the right button,
but my boss doesn't want that: he wants 2 different links).


I want a cool breeze and bright sunshine tomorrow, but
Mother Nature brooks no defiance.

Slainte! & HAGW!

--
Jock
Jul 17 '05 #3
ti***********@nospam.it wrote:
I have a txt file in my server.
I have to provide to the user 2 links.
One link is to download the file and the other one is to display it inside the browser.
Is it possible?


Have a look at the PEAR HTTP_Download package
(http://pear.php.net/manual/en/packag...-download.php). It
might make your task easier. However as others have pointed out, how
your content is handled depends on the client's browser not your
server.

--

Raj Shekhar
System Administrator, programmer and slacker
home : http://rajshekhar.net
blog : http://rajshekhar.net/blog/
work : http://netphotograph.com

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Miguel Dias Moura | last post by:
Hello, in my web site i display some links to PDF files. This links are loaded from a database. Anyway, when i click these links the PDF files are open in the visitors browser and in Acrobat. ...
3
by: David Reynolds | last post by:
Does anyone know how I could stream Excel to the browser for download without saving the file somewhere first. I wasn't sure how I would go about it.
2
by: Rani | last post by:
Hi guys i would like to add a file download capebility to my website how do i do that ? currently i have few pages on my web site and would like add a regulation file for the users to download....
5
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. ...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
4
ak1dnar
by: ak1dnar | last post by:
Hi, How to display a file download dialog box using PHP. is there any header for this. Currently i have uploaded some .pdf and .doc files to the web site. Now i need to give the download links to...
7
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a...
1
by: naza | last post by:
Before I start I would just like to say that I am totally new to programming so the things that I am going ask probally will sound basic and I might sound I bit ambitious in what I want to do. The...
12
by: Bob Bedford | last post by:
I've to build a website where the customer can buy an image. I'm thinking in the 2 ways to let people get those images: receive them by Email or send them an image link wich validity is limited in...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.