-
MODX Staff
- 10,725 Posts
Forget the import tool for now; that is something completely different. If you manually upload a PDF file and create a static resource for it pointing at the proper file, does it work or not?
I’m having a similar problem as described above. I’m trying to create a static resource for downloading a PDF. I’ve created a PDF content type (application/pdf, binary checked, .pdf extension) and chose it as the content type on the static resource. Content disposition is inline. Template is set to a custom template containing just [[*content]] (I’ve tried Empty template as well). When I request the saved static resource the response is always a 500 error.
If I uncheck the binary option in the content type definition the pdf file will download and display successfully. It works but obviously the system is parsing the file before sending so any pdf file greater then a certain size will produce an out of memory error.
I can load the pdf file successfully directly from the server.
I’ve replicated this on a handful of hosted virtual servers and get the same result every time.
If it helps here is what I’m running:
PHP Version 5.2.13
ZLib Support enabled
json support enabled
json version 1.2.1
GD Support enabled
PDO drivers sqlite, sqlite2, mysql
PDO Driver for MySQL, client library version 4.1.22
SimpleXML enabled
safe_mode Off
register_globals Off
memory_limit 32M
Apache/1.3.42
This is the request and response headers in both cases (binary checked and un-checked).
1. Binary content type checked (fail):
REQUEST
(Request-Line) GET /index.php?id=43 HTTP/1.1
Host xxx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
RESPONSE
(Status-Line) HTTP/1.1 500 Internal Server Error
Date Fri, 06 Aug 2010 01:33:35 GMT
Server Apache 3
Connection close
Transfer-Encoding chunked
Content-Type text/html; charset=iso-8859-1
2. Binary content type unchecked (success):
REQUEST
(Request-Line) GET /index.php?id=43 HTTP/1.1
Host xxx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Cookie PHPSESSID=44f8bd7b154f8c2408fcfd91fb4ffb5e; ys-modx-resource-tree=s%3A/root/web_0/web_4/web_44
RESPONSE
(Status-Line) HTTP/1.1 200 OK
Date Fri, 06 Aug 2010 02:17:57 GMT
Server Apache 3
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
X-Powered-By PHP/5.2.13
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type application/pdf; charset=UTF-8
I got it to work by setting the Content Type to "PDF", the template field to "empty" and the Content Disposition to "inline". A link to the resource offered up the .PDF file.
I don’t see how [[*content]] would be a good idea because you only want to serve up the file.
No idea on apsx.