I am sure that I'm missing something. APIs are new to me.
The API works, it creates the file ok, I just can't force it to download (prompt to download would also be ok) .
This is how I got the Zip to download in a v6.x entry point called from a SugarWidget. How do I do this in v7?
($filename is the path to the file relative to sugar root).
header("Pragma: public");
header("Cache-Control: maxage=1, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$display_filename."\";");
// disable content type sniffing in MSIE
header("X-Content-Type-Options: nosniff");
header("Content-Length: " . filesize($filename));
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
set_time_limit(0);
@ob_end_clean();
ob_start();
readfile($filename);
@ob_flush();
@unlink($filename);
thanks,
FrancescaS