file download....

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Mon Sep 08, 2003 1:56 am


I have written a small script allowing users to download a file by simply click on the link....

The link looks like that:

Code: Select all

echo "file: <a href=\"download.php?doc=$file\" class=maintext>$file</a><br>";

And here the code in my download.php file

Code: Select all

$file= $HTTP_GET_VARS['doc'];

  header("Content-Type: application/download\n");
  header("Content-Disposition: attachment; filename=\"$file\"");
  $fn=fopen("$file" , "r");


You r gonna tell me where is the prob if everything woks???
The stuff is that once the file is download IE keep loading a page.. "this little annoying sand thingy"
How can I stop that...???


ps:sorry I knw it might not be revelant to php

How can

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Mon Sep 08, 2003 12:15 pm

can you make header location to file? or you dont wont this?

php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Mon Sep 08, 2003 8:39 pm

or you make the zip file of that file and give path
will give user download dialog...
or use the above said method
something strange will be ...

Post Reply