Hello,
I'm trying to not have to download the attachments and view them directly in the browser. I found this viewtopic.php?f=13&t=4827&p=21073#p21064 but it seems it's for an older version because doing that change doesn't seem to affect 2.5.3. I understand the risks involved with doing it this way so I'm ok with that.
Any other ideas?
Thanks
Viewing attachments in browser
Moderator: mkoch227
Re: Viewing attachments in browser
Same file and instructions, but instead of search for
Code: Select all
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
Code: Select all
header("Pragma: ");
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Viewing attachments in browser
Thanks Klemen, that's what I was thinking but it still pops up with a download dialogue.
here's the code that it looks like:
download_attachment.php:
here's the code that it looks like:
download_attachment.php:
Code: Select all
// Send the file as an attachment to prevent malicious code from executing
$open_directly = array(
'pdf',
'jpg',
'jpeg',
'gif',
'png',
'txt',
);
if ( isset($open_directly[strtolower(pathinfo($file['real_name'], PATHINFO_EXTENSION))]) )
{
header('Location: ' . $realpath);
exit();
}
header("Pragma: "); # To fix a bug in IE when running https
header("Cache-Control: "); # To fix a bug in IE when running https
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $file['size']);
header('Content-Disposition: attachment; filename=' . $file['real_name']);
Re: Viewing attachments in browser
Thanks code redirects the browser to the file, but what the browser does with that file is up to the browser and not something HESK controls.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools