file download....

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

file download....

Post by cho@ » Mon Sep 08, 2003 1:56 am

Hi,

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");
  fpassthru($fn);
  fclose($fn);

?>


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...???

Thanks
francois

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


How can

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

Post by Oleg Butuzov » Mon Sep 08, 2003 12:15 pm

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

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

Post by sigix » 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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest