## General help

Over the past couple of days, I've been getting error messages when I try accessing PDF type resources....

"The file is damaged and could not be repaired"....

When I go to the server's directory, I'm able to open the PDF's without errors.

Any thoughts or suggestions?

Thanks.

Average of ratings: -
Have you tried on other client machines and with different browsers? Stupid question probably, but do all the files end with .pdf? (we have had some weird problems with files uploaded from Mac OS9 which does not bother with file suffixes)

Also, check your web server error logs - just in case something is going wrong in the download and the file is getting truncated - you might see something there.

Average of ratings: -

on my moodle site for some reason pdf docuemtns will not load - strange but if you change the file name so that it has no spaces in it- this will work! but i am not willing to do that for every pdf document that get uploaded.

seems to be when they have uploaded a whole folder in one go etc:

can someone help

Average of ratings: -

Average of ratings: -

http://moodle.org/mod/forum/discuss.php?d=15746

We had a problem with pdfs in IE but not Firefox.

I tried a bunch of stuff, but disabling cache was what "fixed" it.

Average of ratings: -

Where do I disable cache in Apache 2? PHP5?

Average of ratings: -

// Seconds for files to remain in caches. Decrease this if you are worried
//      $CFG->filelifetime = 86400; Uncomment the last line from the snippet above in your moodle config.php Set the time to zero. You will be able to see pretty quickly if it works. Good luck... Tom Average of ratings: - Re: PDF's not loading...... I set the CGF->filelifetime = 0; Rebooted the server. I have PHP5 and Apache 2. I'm still receiving the error ... "The file is damaged and could not be repaired". PDF is intact on the server, however. This is a critical issue to resolve, since there are so many PDF's on our system. Average of ratings: - Re: PDF's not loading...... Did you clear your browser cache? If it does not help you can try to change headers in file.php: @header('Cache-Control: no-store, no-cache, must-revalidate'); @header('Cache-Control: post-check=0, pre-check=0', false); @header('Pragma: no-cache'); @header('Expires: Mon, 20 Aug 1969 09:23:00 GMT'); @header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); @header('Accept-Ranges: none'); It should completely disable caching. If it works you may disable caching only for pdfs... If you have any cache/proxy in between you might need to refresh its content too. skodak Average of ratings: - Re: PDF's not loading...... I cleared browser cache and tried adding the code you provided towards the top of file.php. No luck. There seems to have been a change to file.php on 12/15/2004 for improving PDF handling. Would this change have anything to do the issues at hand? Average of ratings: - Re: PDF's not loading...... It was my change, I have added: @header('Accept-Ranges: none'); It should not break anything, but you can try to erase it. PDF issues were reported before this change. PHP code in file.php does not support ranges, so it is correct to send this header IMO. skodak Average of ratings: - Re: PDF's not loading...... skodak, I commented out the "Accept ranges: none" in the header and now all of my PDFS are loading just fine. The Accept-Ranges parameter had an adverse side effect for PDF files..... Thanks for letting me know what changed. Average of ratings: - Re: PDF's not loading...... Addind to top of file.php is not enough, you have to replace the old code: header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $CFG->filelifetime) . " GMT"); header("Cache-control: max_age =$CFG->filelifetime");
header("Content-disposition: inline; filename=$filename"); header('Accept-Ranges: none'); Average of ratings: - Re: PDF's not loading...... Well, interesting that it spoiled your installation, I am going to revert the commit now. Thanks for report! Average of ratings: - Re: PDF's not loading...... We have added a self-signed SSL Certificate to our site and everything seems to be working well except for serving up Certificates to students in the inline frame (instructors get them as file download link). We are on 1.9. Does anyone have any updated header changes to make and in what files? When I browse around I am not seeing anything that looks relevant in any "file.php". The closest I could find was a few sections in ./moodle/lib/filelib.php. I have not had any luck with the force download option from the activity settings for the certificate via course edit mode. I am also retesting that to make sure I just was not seeing the change due to some sort of cache / proxy. Thank You, Kyle Average of ratings: - Re: PDF's not loading...... Hi Kyle, are you using IE? See here for a possible tip: if it will work (what is your IE version?), it could be possibile to arrange lib/filelib.php::send_file() to address such issue without requiring any fix client side. HTH, Matteo Average of ratings: - Re: PDF's not loading...... Thank you Matteo.. I will take a look at that function and see if I can get the right recipe of header options in place to get it working. We are using Apache on RedHat on the server side. Our students are primarily using IE 8 (Unless they also login at home / their own laptops they are not local admins.. IE 8 is probably the majority situation since they have time allotted to work on the PCs they are provided). There would be little that we could do to feasibly influence much more for changes on how the client side is managed beyond us being an allowed / trusted site. So we definitely need our fix to be something something mainly on our side. Average of ratings: - Re: PDF's not loading...... Hi Kyle, you can also try to add$CFG->disablebyteserving = true to your config.php to avoid Adobe plug-in to take just pieces of your PDF in order to decrease the time required to view the PDF especially for large files (any workaround could have some drawbacks...).