Open PDF Files instead of downloading them

Phoca Download - download manager
latorreinfo
Phoca Member
Phoca Member
Posts: 11
Joined: 06 Jun 2020, 18:09

Open PDF Files instead of downloading them

Post by latorreinfo »

I've just installed phocadownload so may have missed something.

I'd like to be able to open and view pdf files in the browser rather than have them downloaded.

I know browsers can be set up to do this but that relies on users knowing how to do this. Another extension I use opens the file rather than downloads it, so it must be possible

Tags:
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9442
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: Open PDF Files instead of downloading them

Post by Benno »

Hi,
see: viewtopic.php?f=31&t=60744

Kind regards,
Benno
latorreinfo
Phoca Member
Phoca Member
Posts: 11
Joined: 06 Jun 2020, 18:09

Re: Open PDF Files instead of downloading them

Post by latorreinfo »

Benno , thank you for your help

Is there any way to only have the preview button and suppress the download option, other than using a customised layout

Kind Regards
Dave
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9442
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: Open PDF Files instead of downloading them

Post by Benno »

Hi,
no, I do not know a way to hide the download button in the options.
So only CSS remains.

Kind regards,
Benno
christine
Phoca Hero
Phoca Hero
Posts: 2819
Joined: 28 Nov 2010, 17:20

Re: Open PDF Files instead of downloading them

Post by christine »

Hi,

as Benno wrote, via CSS, example from a demo, as live site not available:

Code: Select all

.pd-button-download {
display:none;	
}
or via Template Override from:

/components\com_phocadownload\views\category\tmpl\default_files.php

belongs apprx. to these lines:

Code: Select all

// pdbuttondownload
			$pdButtonDownload = '<div class="pd-button-download">';
			$pdButtonDownload .= str_replace('class=""', 'class="'.$cBtnSuccess.'"', $linkDownloadB) . JText::_('COM_PHOCADOWNLOAD_DOWNLOAD') .$linkDownloadE;
			
			$pdButtonDownload .= '</div>';
e.g. to comment out.

if using Bootstrap Output:
components\com_phocadownload\views\category\tmpl\default_files_bootstrap.php

to:
templates/your_template/html/com_phocadownload/category/directory

Kind regards
Christine
latorreinfo
Phoca Member
Phoca Member
Posts: 11
Joined: 06 Jun 2020, 18:09

Re: Open PDF Files instead of downloading them

Post by latorreinfo »

Thanks, another question

- do you know the routine that invokes the actual download of the file. I'm wondering if its possible to change the behaviour so the browser decides whether to do a download or process the file (eg display a pdf file) rather than a download happenig every time.

-i'm wondering if this is could be used as an alternative to view - which doesnt appear to work on an _ _ or _ _ as only the first page gets displayed.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Open PDF Files instead of downloading them

Post by Jan »

Hi, the main function of the component is download component. So it means, it tries to force downloading the file before displaying it when the download button is clicked.

Everything with download happens here:
administrator\components\com_phocadownload\libraries\phocadownload\download\download.php

including the setting of header which tries to force downloading instead of displaying, etc.

So if there should be done some changes, then in this file.

Jan
If you find Phoca extensions useful, please support the project
latorreinfo
Phoca Member
Phoca Member
Posts: 11
Joined: 06 Jun 2020, 18:09

Re: Open PDF Files instead of downloading them

Post by latorreinfo »

Jan

thank you - I will take a look
latorreinfo
Phoca Member
Phoca Member
Posts: 11
Joined: 06 Jun 2020, 18:09

Re: Open PDF Files instead of downloading them

Post by latorreinfo »

Jan.
thanks for you advice - by changing 'content-disposition: attachment' to 'content-disposition: inline' I can now view the file rather than downloading it when the download button is clicked. The advantage of this is 'viewing' is now controlled by security constraints so the file can be in a protected directory outside of public_html or controlled by .htaccess and stopping direct downloads using a URL in the browser.

Maybe the inline option could be considered as a configuration option for a future release.

As an aside the forum search appears to only display the first few results and I cannot see a way to scroll furhter down?
Dave
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Open PDF Files instead of downloading them

Post by Jan »

Hi, Ok, added to feature request list.

Forum - do you get any Javascript error? Which browser do you use?

Jan
If you find Phoca extensions useful, please support the project
Post Reply