Header download file is corrupted Header download file is corrupted database database

Header download file is corrupted


In your non-OOP solution check for leading whitespaces inside the php file.

The following code would produce a corrupted file because of a leading whitespace.

 <?phpif (isset($_GET['id'])) {...

This also applies to whitespaces after the closing php tag (which you should not use).

Those chars will be submitted by your browser, included in the download stream and corrupt the whole file.