I'm currently working on a website I did not personally developped. It's is wordpress based, but a lot of developement had been made to it by external people.
We have a problem with some pdf's. When people are downloading these pdf's or even images, they are corrupted. I investigated why, and I found out, by opening the files with notepad, that the html of the webpage was at the begining of the document. if I delete this html, the pdf is not broken anymore.
I know what the problem is, but I cant seem to find how to fix it. Here is the html link for the "download" button.
<a href="<?php echo get_bloginfo('url');?>/?download_process=<?php echo $_GET['dl'];?>" target="_blank" id="#downloadfile_atag" class="downloadfile_atag" style="display:none;">Download</a>
When I click on this button, the page is refreshed, and the download starts.
I found this line in the code that should be the part of the code that takes care of catching the "GET" :
if (isset($_GET['download_process'])) {
The code in this "if" is a bit more than 100 lines and I'm not experienced enough to know what to do. I would need some advices to where to look. For example, There is
ob_start();
at the beginning, and an
ob_clean();
in the middle of the code. Is it normal that there is no
ob_end_clean(); // or
ob_end_flush();
or something like that ?
Or may be is does not come from this buffer. What kind of instruction should I be checking for?
Or may be it does not come from that part of the code, and if so, I'm really lost...
Anyway, thank you in advance for your answers.
Guillaume.
Is there anything about
header();
in the IF statement you have not shown us?If so is there anything about content size? (this is something I am working on at the moment so have a couple of ideas)
$fsize is the size of the content for download.