PHP Download problem
Posted: Thu Jul 01, 2010 4:33 am
I am having issue downloading documents from my php page. When download a word document it opens it in raw format in the browser?
I'm guessing this is an issue with header types but I'm also unsure if this is a security problem over https too? I think it’s trying to download it via a php page.
This is my header code -
I am a php newbie please help.
Many thanks in advance.
I'm guessing this is an issue with header types but I'm also unsure if this is a security problem over https too? I think it’s trying to download it via a php page.
This is my header code -
Code: Select all
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' .filesize ($Path) );
header('Content-Type: '.$mime_type);
header('Content-Disposition: attachment; filename="'.$result->fileOriginalName.'"');
readfile(JPATH_BASE.'/uploadfile/documentFile/'.$result->fileName.'');
header("Connection: close");|Many thanks in advance.