help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

Corrupted pdf download from attachements?

Re: Corrupted pdf download from attachements?

5 years 8 months ago
#25944
Hi,
no solutions founded...
1) disabled all plugins
2) disabled gzip
3) disabled https
4) downgraded php to 7.0
5) uploaded website on dev server or tests dev-server
6) loaded phocadownload : it works correctly... phoca download
7) changed the template to Protostar
I have no others ides...
Any suggestion ?

Please Log in or Create an account to join the conversation.

Re: Corrupted pdf download from attachements?

5 years 8 months ago - 5 years 8 months ago
#25946
stefanato wrote: I have no others ideas...

Same here, sorry.
Last edit: 5 years 8 months ago by Egnarts.

Please Log in or Create an account to join the conversation.

Re: Corrupted pdf download from attachements?

5 years 8 months ago
#25993
My users were reporting issues with opening/downloading attachments as well, especially on mobile devices. I ended up replacing link to function getfile with simple link to the file itself. No download issues reported since.

In file
Code:
/components/com_jem/common/views/tmpl/default_attachments.php
Replace these 2 lines
Code:
$attribs = array('class'=>'file-name'); echo JHtml::_('link','index.php?option=com_jem&task=getfile&format=raw&file='.$file->id,$image,$attribs);
With these 2 lines
Code:
$attribs = array('class'=>'file-name','target'=>'_blank'); echo JHtml::_('link',str_replace(JPATH_SITE, "", JEMAttachment::getAttachmentPath($file->id)),$image,$attribs);
The following user(s) said Thank You: HerKle

Please Log in or Create an account to join the conversation.

Re: Corrupted pdf download from attachements?

5 years 8 months ago
#25996
Hi, thanks for suggestion and this seems to be the right way, but in the link created the domain is missed :
new download link : https://media/com_jem/attachments//event679/foto_a_pagina_intera_859405488.pdf
but should be www.omco.pd.it/media/com_jem/attachments//event679/foto_a_pagina_intera_859405488.pdf
Any suggestion ?
This is the working page: www.omco.pd.it/formazione/corsi-e-convegni/event/679-medico-di-campo-diritti-e-doveri.html

thanks in advance.

Please Log in or Create an account to join the conversation.

Re: Corrupted pdf download from attachements?

5 years 8 months ago
#25997
It looks like your Attachment Path (BE->Components->JEM->Settings ->Global Parameters tab) has "/" before and after path, thus creating starting //, which prevents browser from adding domain name. This is due to function postUpload in JEMAttachment class adding / on line 38
Code:
$path = JPATH_SITE.'/'.$jemsettings->attachments_path.'/'.$object;
If you can modify Attachment Path not to have / surrounding your media/com_jem/attachments that will resolve the missing domain in link.

Please Log in or Create an account to join the conversation.

Re: Corrupted pdf download from attachements?

5 years 8 months ago - 5 years 8 months ago
#25998
Just thought of something... that will work only for newly added attachments, since the attachment path is stored in DB. Probably, best then to add code to replace all "//" in attachment path with "/". Will test now and post here next few minutes.

Checked - attachment path is not stored in DB, so amending settings will do the trick.
Last edit: 5 years 8 months ago by depebo. Reason: checked DB and added last statement

Please Log in or Create an account to join the conversation.

Time to create page: 0.470 seconds