Jump to content

Problem in downloading


leela

Recommended Posts

 

Hai ,

 

I Was struck up here ..

When i download , instead of open/save dialogue box ...... the content in the file is displaying ..

 

Here is my code

 

$sql="select * from tbl_images where id='".$id_img."' ";

  $res=mysql_query($sql);

  $arr=array();

  while($row=mysql_fetch_array($res))

  {

  array_push($arr,$row);

  }

 

  $file="personal_photos/".$arr[0]['path'];

 

header("Pragma: public");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

 

header("Content-Type: header/force-download");

header( "Content-Disposition: attachment; filename=".basename($file));

header( "Content-Description: File Transfer");

@readfile($file);

 

Plz some one tell me where the mistake is ???

 

Thanks,Leela

Link to comment
https://forums.phpfreaks.com/topic/68968-problem-in-downloading/
Share on other sites

 
           header("Pragma: public");
           header("Expires: 0");
           header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
           header("Cache-Control: private",false);
           header("Content-Type: image/jpeg");
           header('Content-Description: File Transfer'); 
           header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
           header("Content-Transfer-Encoding: binary");
           header("Content-Length: ".filesize($filename));
           set_time_limit(0);
           @readfile("$filename") or die("File not found."); 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.