function Download_Delete_File($filename,$destPos) {
ignore_user_abort (true);
set_time_limit ( 0 );
$file_path = './'.$filename;
$file_type = 'text/csv';
$file_name = $filename;
//header ( 'Cache-Control: max-age=31536000' );
//header ( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header ( 'Content-Length: ' . filesize ( $file_path ) );
//header ( 'Content-Disposition: filename="' . $file_name . '"' );
header ( 'Content-Type: ' . $file_type . '; name="' . $file_name . '"' );
header('Content-disposition: attachment;filename="' . $file_name . '"');
ob_clean();
flush();
readfile ( $file_name );
unlink ( $destPos );
unlink ( $file_name );
exit ();
}
Hi all,
I have used the code above to do a download of a file generated by PHP code on the client and it works.
Now I have the problem of making the browser write more echoes to indicate that the file is in the download folder and some other information.
I have tried removing the exit command to make the PHP code continue but it does not work.
I also tried ob_start, $continue=ob_get_clean, but I can't see the rest of the code on the browser.
It just stops at the start page without continuing.
Do you have a suggestion to continue the php script so that it shows me the rest of the print functionthat is called after the download?
I also tried calling the print function first, but to no avail.
Do you have any ideas that can help me?
Thanks