Hello for all
I have problem in downloading file by php script , this is my code :
$path = "/home/user/public_html/foldername"; //Change "user" to your username
$mainpath = "$path$file";
header("Cache-Control: ");# leave blank to avoid IE errors
header("Pragma: ");# leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$file."\"");
header("Content-length:".(string)(filesize($mainpath)));
sleep(1);
readfile("$mainpath");
the link for this code is : www.sitename.com?file=file.zip
when click for this link its ask you to download the file and when click at save , it save to ur computer with file name and file type but its empty :
for example if file.zip with size 0.5 mb download only empty file with size 200 byte
hope you can help me
Thanks alot