Force File Download

in Download Manager Free

Viewing 6 posts - 1 through 6 (of 6 total)
Apr 1, 2022 at 9:26 pm
#170791
Member
John
OP

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?

Apr 2, 2022 at 6:47 am
#170797
Spectator
Tanvir

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

Apr 3, 2022 at 1:51 pm
#170825
Member
John
OP

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).

View post on imgur.com

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?

Apr 3, 2022 at 6:42 pm
#170837
Spectator
Tanvir

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

Apr 3, 2022 at 7:54 pm
#170838
Member
John
OP

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.

Apr 4, 2022 at 4:39 pm
#170892
Spectator
Tanvir

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

Viewing 6 posts - 1 through 6 (of 6 total)

The topic "Force File Download" is closed to new replies.