leiborquisa
New Member
I'm currently using the following PHP function to allow a user to select a file and then download it. This happens over FTP. However, if the user chooses a large file then while the download is occurring it locks up the server for any other requests. Is there any way I can host the file while having PHP continue to respond to requests?I need PHP to verify that the user is permitted to download the file with their credentials so I can't just host it as an asset. The file is located on an FTP server.\[code\]function download($file) { $fileStream = ""; if($this->get($file)) { //Send header to browser to receive a file header("Content-disposition: attachment; filename=\"$file\""); header("Content-type: application/octet-stream"); header("Pragma: "); header("Cache-Control: no-cache"); header("Expires: 0"); $data = http://stackoverflow.com/questions/14430102/readfile($this->downloadDir . $file); $i=0; while ($data[$i] !="") { $fileStream .= $data[$i]; $i++; } unlink($this->downloadDir . $file); echo $fileStream; exit; } else { return false; }}\[/code\]