Forum Moderators: coopster

Message Too Old, No Replies

Data processing script's headers

not sure if this is the right place, but couldn't find a header forum

         

John_Keates

11:27 am on May 14, 2006 (gmt 0)

10+ Year Member



Hello,
I'm building a new dataprocessing script for a new cms. It should together with index.php be the only web-accessable files. data.php takes some get arguments and then gets the data (css, images, audio/video, downloads) from a file or database. The problem is with images and swf files that they shouldn't be named data.php so I added the header:

header('Content-Disposition: attachment; filename="' . substr
(realpath($_GET['f']), strlen($dir['path']['doc'])) . '"');

that sets the filename, but also makes the file attachment. That's what I want if the case is download but not with images or other inline media.
I cannot find a header that only changes the name... Someone with the solution?

John_Keates

12:00 pm on May 14, 2006 (gmt 0)

10+ Year Member



I think I forgot to say what I'm searching for, I meant: a HTTP header that sets the filename. Like in Content-Disposition but without the attachment setting

John_Keates

12:32 pm on May 14, 2006 (gmt 0)

10+ Year Member



Solved, sorry for me not trying out just removing attachement.
it's just:
header('Content-Disposition: filename="' . substr(realpath($_GET['f']), strlen($dir['path']['doc'])) . '"');

dreamcatcher

4:50 pm on May 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it sorted John_Keates. :)