in reply to Re^2: downloading files from mySQL
in thread downloading files from mySQL

Leave off all the HTML stuff and header. You should send the file content as the ONLY content of the response, and set the headers accordingly. You can't mix HTML and random other data in the same response. An html response is normally just a single "file" or bit of content.