Forum
Unable to upload PDF files
Recently Perch Runway stopped allowing the upload of PDF files in my install. I click upload, select the file, the progress indication shows it uploading, but it doesn't make it to the server. This has always worked in the past.
In my debug message I do see "Form not posted or did not validate"
In my template, I have
<p><a href="<perch:content id="printmap" type="file" label="Printable map" bucket="preserve_maps" />">Download a printable preserve map (PDF)</a></p>
I have checked the file permissions on the resources folder, as well as the specified bucket and they are both set to 755.
We need to see your full template and your Diagnostics Report to be able to help.
Here is the full template
and the diagnostics
Your template has errors, I can see that you have closed the perch:related opening tag. I would check that your template is correctly formed (I usually just remove fields till it starts working then put them back in one by one to find the culprit if I can't spot them).
Should the perch:related tag not be closed?
And why would other file types work fine still, just not PDF files?
This:
should be this:
Got it, but that isn't related to my problem. This template has worked fine until a recent update to Perch, where it suddenly became impossible to upload PDF files specifically. It appears to upload them, but the asset doesn't appear and the file isn't in the resources directory.
Any template error can potentially cause problems with the parsing of the template, so it's important to fix.
How large is the file you're trying to upload?
It's about 350kb.
Is there anything in your server error log that relates?
I don't see anything in the server log that looks like it's related to this.
Here's the (fixed) template:
and the debug output:
Again, this has been working for quite some time, so it's hard to know why it would suddenly stop.
I did find these two lines in the server logs:
That looks like the access log. Do you have an error log?
Yes, there are no errors related to this problem. Super weird.
I'm not sure I have anything further to suggest.
Thanks. I'm sure I'll figure it out eventually.
Could this be related to the use of GD Imagick on my server to process images?
Which are you using currently?
Well, I never have been able to figure this one out. Uploading PDFs on my local copy of the site is no problem, but I've been unable to upload them to the live site.
This is using the Assets button, so it's not a problem with any of my templates. I've tried GD and ImageMagick, neither works. Here is the debug output:
Perch Runway is the latest version. Permissions on the buckets have been checked and re-checked.
Help!?!
Problem solved. I turned on Paranoid mode a while ago and had "define('PERCH_VERIFY_UPLOADS', true);" which apparently triggered this problem. That must mean that my filetypes.ini file rule for PDF files is wrong (I have "application/pdf".)
Thanks.