FW: [PHP] PHP Timeout and Long Download
| From: | Krznaric Michael | Date: | Wed, 16 Aug 2000 16:28:42 +0000 |
| Subject: | FW: [PHP] PHP Timeout and Long Download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12052@lists.php.net to get a copy of this message | ||
To the list as well in case anyone is interested too?
-----Original Message-----
From: Krznaric Michael
Sent: Wednesday, August 16, 2000 12:26 PM
To: 'Robert J. Cissell'; Krznaric Michael
Subject: RE: [PHP] PHP Timeout and Long Download
Sure.
As an intro i'm using a single script that parses the request URL and sends
the files accordingly.
http://mysite.com/dynamic/some/path/file.ext
^^^^^^^
dynamic is my script name. It then parses the $PATH_INFO (the stuff
following my script name) to find out which file it needs to send. I have
to map it to my file system.
O.k. Now that you know this (which you probably didn't need to know, just in
case). I
have a function called GetMimeType which searches the
/apache/conf/mime.types file and gets the appropriate mime type for the
extension (.ext)(The stuff that goes in the header).
Then all i do is
$Type=GetMimeType($Extension, $Mime_Types);
if (!is_string($Type)){
print ("ERROR $Type: Cannot get Mime Type for $Extension");
exit;
}
else {
header ("Content-Length: ".filesize ($MapTo));
header ("Content-Type: ".$Type);
$fd=fopen ($MapTo, "r");
fpassthru ($fd);
fclose ($fd);
}
That's. It it should work for you. If you're always sending the same type
of file you don't need to search for the mime type, you can just hardcode
it. If you look at your mime.types in your apache/conf directory you need
to send the first part of the line as the header (which is what my script
retrieves with GetMimeType).
And off course $MapTo is the location of the file you want to send.
Let me know if you need any more info.
Mike
-----Original Message-----
From: Robert J. Cissell [mailto:rcissell@tampabay.rr.com]
Sent: Wednesday, August 16, 2000 12:09 PM
To: Krznaric Michael
Subject: Re: [PHP] PHP Timeout and Long Download
Hey, I don't know the answer for your question, but could you share with me
how you sent the files? I've been trying with headers but it's not working
at all. Thanks.
----- Original Message -----
From: "Krznaric Michael" <mkrznaric@rand.com>
To: <php-general@lists.php.net>
Sent: Wednesday, August 16, 2000 12:10 PM
Subject: [PHP] PHP Timeout and Long Download
> I am using php to send some files to the user. If the user download is
> taking longer than the script timeout will that affect the download? I
> mean, will the script be killed before the download is complete or does
the
> script execution end and it's the OS job to deliver the file?
>
>
> Michael Krznaric
> RAND Worldwide
> Webmaster
> 905-625-2000 x 2325
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>