- This topic has 6 replies, 2 voices, and was last updated 3 years, 11 months ago by
Tanvir.
Firefox browser allows the user to set how a PDF file will be handled: Download, Open, Ask.
I want to override the user setting and force a download using HTML “Content-Disposition: attachment”.
How can I implement this for a file stored on Google Drive?
Hello,
Hope you are well.
Could you please share related website link to check the issue properly.
However, If you are using remote url then download or open in browser will not depends on wpdm pro, If you want to force download, you need to upload it with wpdm pro or use server file browser to attach file.
Thanks
I just tested and it does not matter where the file is located (server or Google Drive). Firefox browser allows the user to specify how they want to hand specific file types (Open in Firefox, Always ask, Save file).
This behavior can be overridden using the “Content-Disposition” HTML property.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Is there a way to tell wpdm to use the “Content-Disposition” HTML property?
Hello,
We have already content-deposition set for audio/video files. You can find it in download-manager-master\src\__\FileSystem.php
However, you can modify that also you can do it using javascript for this.
Thanks
I looked at download-manager-master\src\__\FileSystem.php and it says “DO NOT CHANGE”. Any changes I make will be over written by a plugin update.
I would like a more detailed explanation of what you are suggesting.
Hello,
If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the » Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
header("Content-Type: {$filetype['type']}");
header("Content-disposition: attachment;filename=\"$filename\"");
You can also check this
Adding this codes in functions.php will work fine. But before that please make sure if firefox do the downloads as you want. for that you can manually try to add any pdf file and add that code manually without any php variable.
However, If you want to force download, please always attach the file using the server file browser or upload directly using wpdm.
Thanks
The topic "Force File Download" is closed to new replies.