Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-26 12:23:36

vanderkerkoff
Member
Registered: 2005-05-26
Posts: 45

change the Content Type in file_download

Hello everyone.

I’m setting up a webglimpse search portal for all of our textpattern web sites. Pretty good software, and free, my favourite.

One problem we’re having is that when glimpse finds one of these links

websitename/file_download/345, if that file is a pdf document then glimpse does not scan it properly, as it doesn’t know it’s a pdf document.

I curled one of the files we’re talking about and got this info back

TTP/1.1 200 OK
Date: Wed, 26 Jul 2006 12:08:35 GMT
Server: Apache/1.3.34 (Unix) PHP/5.0.5
X-Powered-By: PHP/5.0.5
Content-Description: File Download
Content-Length: 561191
Content-Disposition: attachment; filename=“blackboard_guide.pdf”
Content-Type: application/octet-stream

%PDF-1.4^M%âãÏÓ
140 0 obj<</H[776 374]/Linearized 1/E 11744/L 561191/N 13/O 143/T 558348>>^Mendobj^M ^Mxref^M140 24^M0000000016 00000

As you can see the data is all mangled as it thinks its an octet stream.

What I need to do is change the Content-Type to application/pdf to see if that fixes the problem. It may well cause a problem then with other types of files, like xls and docs,. but I’ll then have to write some conditional coding to alter the application type by extension of attachment.

If anyones had a simliar situation I’d love to hear how you got around it.

If I set glimpse to access the directory instead of the URL, it finds the pdf files themselves and gets the correct applicaiton-type and works OK, but how do I acces other web sites based on directory? And I’d also have to stop the web part of the index form accessing files_download.

If we can change the app type, I think it might be easier.

Thanks in advance

Offline

#2 2006-07-26 12:52:12

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: change the Content Type in file_download

Thi feature is not currently available in textpattern. But I am sure it will eventually be in future major releases.

Iin the meantime you can modify the code in publish.php to serve files with certain names, with different MIME-headers.

Offline

#3 2006-07-26 21:03:48

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: change the Content Type in file_download

If selectable mime-types are on the list for new versions , how about the option to select application/xhtml+xml instead of text/html for teh main site headers?


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

Board footer

Powered by FluxBB