File Upload element disconnects user upon download

Mustafa_s

Member
Hello,

I have a file upload element in a repeatable group. The element works fine for the most part but I have a few questions:

1) How can I make the links in the file upload element open in a new window in details view? I tried the following code in the elements Javasvript on Load but that made all links open in a new window. How can I ensure only the links from the file upload element open in a new window? As it stands every attachment type opens in a new window except PDFs.


Code:
window.onload = function(){
  var anchors = document.getElementsByTagName('a');
  for (var i=0; i<anchors.length; i++){
    anchors[i].setAttribute('target', '_blank');
  }
}

2) When I download files in details view such as ZIP files, everything is ok. The file get's download and I'm able to continue inside the website. But when I open PDFs (which open in the same window) and click back to go to the details view again I'm presented with the Joomla login window. The user gets disconnected each and every single time they view the PDFs. I dont think I want to use the download script as I would like to see the file name of the attached file.

My setup is as follows:

2tDFi6u.png

hBerKD9.png

ywYNUz1.png
 
I can't replicate the disconnect.

To open the pdf in a new window you can use to new layout feature.
You must update from GitHub to get the code.
Then copy
your-site\plugins\fabrik_element\fileupload\layouts\fabrik-element-fileupload-pdf.php
to
your-site\templates\your-template\html\layouts\fabrik-element-fileupload-pdf.php
and change
<a class="download-archive...
to
<a target="_blank" class="download-archive...
 
Thank you troester, I will update as you suggested and let you know of my results when I get back home tonight.

With regards to the user disconnect upon PDF download, where can I start troubleshooting? Very odd that the user session disconnects only on PDFs and not any other file type (JPEG, ZIP, Etc..). I'll have to investigate this furthermore.

Mustafa
 
Hi Troester,

Quick update regarding the user session disconnect, I think I know why it was happening and I can reproduce the issue/solution.

I have a SSL certificate installed on my domain, when I access the Fabrik form via "http" (non SSL) I experience the user session disconnect when downloading PDFs. However, when I access the Fabrik form via "https" (SSL) I do not experience the user session disconnect when downloading PDFs.

So at least I know what was causing the issue, what I'll do is force my Joomla install to always use https instead.

Thank you once again for your great support to the community.

Mustafa
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top