Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

downloading file problem 1

Status
Not open for further replies.

rbauerle

Programmer
Oct 16, 2001
48
BR
I need a way to allow my users to download a file wich is not compressed with one only click.
For example: I have a link to the file 'test.doc'. I don't want it to be opened when clicked, I want it to be downloaded. any suggestions?
Thanks,
Renata
 
It's not working the way I thought it would.

This is what I'm doing:

<?
header('Content-type: application/txt');
header('Content-Disposition: attachment; filename="arqs/test.txt"');
?>

Note that this file is not being generated here. It was previously uploaded to the folder 'arqs/'.

How do I manage to inform the file name and path to this function?

Thanks again,
Renata
 
header('Content-type: application/txt');
header('Content-Disposition: attachment; filename="test.txt"');
readfile('test.txt');

this was my last try. still doesn't work. it opens the file - shows its content. Would there be an example of a working script for me to take a look?

Renata
 
This script:

<?php
header('Content-type: application/txt');
header('Content-Disposition: attachment; filename="test.txt"');
readfile('test.txt');
?>

which was taken from your post, works for me from my LAMP box with both Opera and IE.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later.

ref.:
Olav Alexander Mjelde
Admin & Webmaster
 
Yeah, IE and headers are a constant source of trouble. If for no other reason that since Win32 is so wedded to file extensions, so is IE.

And there has long been intriguing verbiage in the "Help/About Internet Explorer" menu selection (This from IE 6.0.x):

Based on NCSA Mosaic. NCSA Mosaic(TM); was developed at the National Center for Supercomputing Applications at the University of Illinois at Urbana-Champaign.
Distributed under a licensing agreement with Spyglass, Inc.


Does this mean that IE still contains Mosaic program code or libraries?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Well. I see your point.
The problem with my script was that I was trying to download the files form another directory.
So I decided to leave the files in the current directory and it seams to be working really well now.

Thanks a lot, anyway.

Renata
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top