If the word document you are trying to download is already on the server,
you could probably just make a link to the file

<a href="http://host.com/document.doc";>

When the user clicks on it, they either view the document if they have the
MS Word plugin, or they are asked to download it.  I'm not sure that using
php is warranted.

Robbert van Andel 

-----Original Message-----
From: Michelle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 7:57 AM
Subject: [PHP] Download File

I would like to download a word-document from another site and save it to my
How would I go about doing this?

I tried:
$filename = "http://host.com/document.doc;

$fd = fopen ($filename, "rb");
$string = fread ($fd, filesize ($filename)); <----ERROR
fclose ($fd);

$fname = "my_saved_doc.doc";
$fp = fopen ($fname, "wb");


Warning: stat failed for http://host.com/document.doc (errno=2 - No such
file or directory) in d:\inetpub\wwwroot\dl-doc.php on line 8

I believe this has something to do with the access rights to the folders or

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 "The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all

Reply via email to