Back to PrivateFiles Support

neidoux
neidoux

Hi,

So far really happy with this plugin, however I've noticed that when the file is downloaded, the file extension appears to be dropped off.... so unless the end user saves the file with a file extension - the file can't be opened after downloading by some users.

I've also run into an issue adding a thumbnail - which threw exceptions on "Private Files" menu page... I was unable unable to remove the plugin for a while due to error "Undefined variable: table" on line 14 of /var/www/vhosts/"domain.com"/httpdocs/plugins/kurtjensen/privatefiles/updates/change_permission_nulable.php

I've rectified issues except for the file extension is not there when a user goes to save file - which is really important for the users. Can it be amended so it's appended to the filename on save?

Last updated

KurtJensen
KurtJensen

I have found and fixed the issue in "privatefiles/updates/change_permission_nulable.php". Sorry about that error on my part and thank you for reporting.

The file extension is set when you upload the file. On the front end, the file name and extension are the same as what you uploaded unless you specify it in the Public File Name text field. That is where you would want the file extension added to any text in there.

Not sure about the thumbnail issue that you mentioned but it sounds like you figured that out anyway.

Let me know if I can be of more help. Kurt

KurtJensen
KurtJensen

Just for giggles, I decided to play a little more with the plugin and noticed that there is an issue with the file name and extension. I will see if I can get this fixed for you very soon.

Sorry for your trouble... Kurt

KurtJensen
KurtJensen

Here is what I found: In Chrome ( on Linux ), PDF files open when clicked due to an extension in Chrome and when I click button to save, the file name was not preserved but instead tried to save as "document.pdf". In Firefox ( on Linux ) the PDF file opens but saves as the proper file name and extension.

If I right click and "Save Link as" instead of simple click in either browser, the file name is correct to the Public File Name that I set for the download.

So it is possible that browsers are also dropping the file extension which may mean that I need to update the file headers to prevent this on download. Currently I am defaulting to the headers provided by October CMS for the Database Attached Files.

Last updated

Hessel
Hessel

Hi Kurt, I'm struggling with this issue to. The plugin is beautiful but the files are saved without extension.

I use your plugin for a community and a workaround is to tell the users: "each file you download you have to add the file extension when saving". but that is not professional.

I found this example below, but it is not dynamic. Do you have a correct code fix that I can use on the page code tab that supports pdf and doc/docx files? or perhaps add dl.privatefile.extension tot the download link?

function onDownload() { $pathToFile = Url::to("/storage/app/media/a.pdf"); $fileName = "download.pdf"; $headers = [ 'HTTP/1.1 200 OK', 'Pragma: public', 'Content-Type: application/pdf' ]; return Response::download($pathToFile, $fileName, $headers); }

p.s. I just look for a quick fix, not an plugin version update.

Last updated

KurtJensen
KurtJensen

A few questions:

  • Did you put any text in the "Public File Name" field?
  • If you did, did you type an extension there?

Here is what I found:

  • When I ran tests where I had that field empty, the uploaded file name with extension was prompted for the download.
  • When I ran tests where I had that field filled with something like "MyDocument.docx", the file name "MyDocument.docx" with extension was prompted for the download.
  • When I ran tests where I had that field filled with something like "MyDocument", the file name "MyDocument" with no extension was prompted for the download.

This is how it is intended to work. Please advise if you have other results.

Hessel
Hessel

Ah my mistake I didn't see the placeholder text. I used "MyDocument" without extension. When I add .pdf tot the Public File Name field the download is correct =)

1-7 of 7