note 86680 added to function.fread

From: Date: Wed, 29 Oct 2008 16:11:22 +0000
Subject: note 86680 added to function.fread
Groups: php.notes 
Request: Send a blank email to php-notes+get-145937@lists.php.net to get a copy of this message
Various scripts suggested here attempt to deliver a file for download to a client. Handling http protocol features such as HTTP_RANGE is not trivial; neither is handling flow control with the server, memory and time limits when the files are large. An alternative is to let the web server can handle http by redirecting to the file in question. It's not uncommon e.g. http://www.apple.com/downloads/macosx/ does this. A PHP script can do any checks needed (security, authentication, validate the file) and any other tasks before calling header("Location $urltofile"); I tested this with apache. Interrupt/resume download works. The server's mime type configuration will determine client behavior. For apache, if defaults in mime.types are not suitable, configuration directives for mod_mime could go in a .htaccess file in the directory of the file to download. If really necessary, these could even by written by the PHP script before it redirects. ---- Server IP: 64.71.164.2 Probable Submitter: 76.19.20.20 ---- Manual Page -- http://www.php.net/manual/en/function.fread.php Edit -- https://master.php.net/note/edit/86680 Del: integrated -- https://master.php.net/note/delete/86680/integrated Del: useless -- https://master.php.net/note/delete/86680/useless Del: bad code -- https://master.php.net/note/delete/86680/bad+code Del: spam -- https://master.php.net/note/delete/86680/spam Del: non-english -- https://master.php.net/note/delete/86680/non-english Del: in docs -- https://master.php.net/note/delete/86680/in+docs Del: other reasons-- https://master.php.net/note/delete/86680 Reject -- https://master.php.net/note/reject/86680 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145937) next »