file - PHP Base64 Decode to PDF browser output -
i'm working web service returns pdf documents file streams (base64_encoded.)
here have far:
$data = $response->data; $data_decoded = base64_decode($data); $file = fopen($file_name,'wb+'); fwrite($file, $data_decoded); fclose($file); header('content-type: application/pdf'); header('content-disposition: inline;filename='.urlencode($file_name).''); header('content-transfer-encoding: binary'); header('content-length: ' . filesize($file)); header('accept-ranges: bytes'); @readfile($file); still darn thing not output valid file.
i've ran string through online base64 decoder , file created!
any thoughts/help appreciated.
Comments
Post a Comment