How to download XLSX that was converted to base 64

Hello, how to download XLSX that was converted to base 64?
File returns empty.

I got:

	header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
	header('Cache-Control: must-revalidate');
	header('Expires: 0');
	header('Pragma: public');
	header('Content-Disposition: attachment; filename="' . $fileName.'.'.$fileExtension . '"');	
	echo $file;
	if (ob_get_contents() || ob_get_length()) {
	  ob_end_clean(); //or ob_end_flush();


if the contents of $file is base64 encoded you should change echo $file to echo base64_decode($file);

1 Like

I tried that that is the same :frowning:
$file comes from curl soap call (WSDL) and it seem to be already decodes (saying that as images works already without base64_decode)

We would need to see where $file comes from, since the problem seems to be with that variable.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.