shnizle Posted February 16, 2010 Share Posted February 16, 2010 hey guys, im having trouble with a simple script.... i use the following script to make a secure download for a file that im hosting: <? include "common.php"; commonConnectToDB(); $sql = "select * from contacts where now()-insertTime < 180"; $res = commonDoQuery($sql); //if (mysql_num_rows($res) == 0) // return; $asfname = "SetupWFMwizard.exe"; $filename = commonGetLayoutSwitchHtml("trialDownloadFileName", "ENG"); $realFileName = "loadedFiles/$filename"; $fsize = filesize($realFileName); /* waiting for PHP 5.3 $finfo = finfo_open(FILEINFO_MIME_TYPE); $mtype = finfo_file($finfo, $filename); finfo_close($finfo); */ $mtype = "application/exe"; // set headers header("Pragma: no-cache"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Length: $fsize"); header("Content-Type: $mtype"); header("Content-Disposition: attachment; filename=\"$asfname\""); header("Content-Transfer-Encoding: binary"); //flush(); $file = @fopen($realFileName,"rb"); if ($file) { while(!feof($file)) { print(fread($file, 1024*); flush(); if (connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } ?> for some reason when im downloading the file with that the script generates i don't have the file size / time left inside the download box , im getting "unknown time remaining" , message due to file size unknown does anyone see a problem with that script? thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.