Assets, media file and direct download -Solved

Q&A about the latest versions
Post Reply
User avatar
Julien
Posts: 55
Joined: Sat Sep 28, 2019 7:05 pm

Hello community,

I am doing a project with a .pdf available to download.

I have added my abc.pdf to the project assets and made a button with the action: mouse click -> go to URL -> assets/abc.pdf
Generating the project and calling the button, it takes us to the pdf webpage with the Print, Download, etc options.

Instead of landing to this pdf webpage, is it possible to get the asset file to be directly downloading only?

Julien
Attachments
Capture d’écran 2020-04-14 à 11.09.10.jpg
Capture d’écran 2020-04-14 à 11.09.10.jpg (77.19 KiB) Viewed 2965 times
Mac, pro version always updated :)
User avatar
Julien
Posts: 55
Joined: Sat Sep 28, 2019 7:05 pm

Thomas Bredenfeld solved this topic after I fowarded it onto Pano2VR Users Group with Facebook.

I'm forwarding his solution and his script.
As it may be handy for others, i've just modified a script i'm using for stuff like this and set up a little helper file for what you need, Julien.

how to use it:
• unzip and put »download.php« into your folder e.g. »download«
• add folder »download« to your assets in the output panel under »advanced«
• put all stuff you need to be forced downloadable in the folder »download«
• instead of setting your download URL to »yourtoursite.com/assets/downloads/mydownload.pdf« set it to »yourtoursite.com/assets/downloads/download.php?file=mydownload.pdf«

»download.php« is meant to work with files in its own folder only.

only requirement is PHP running on your server, but as you're using wordpress, this is guaranteed ;-)

hope this works and helps ...
From my side when writing the topic, I was pretty sure that my enquiry was related to P2VR itself, and not something extra related to the webserver or so :roll: My experience with web, php and so, is limited.
Thanks again Thomas Bredenfeld

Julien
Attachments
___force_download.zip
(890 Bytes) Downloaded 147 times
Mac, pro version always updated :)
Norris Design
Posts: 4
Joined: Thu May 21, 2020 12:30 pm

Julien-
I was glad to find this thread, but I must be missing a step or something…

First off the way we upload it to our website is by uploading the whole ggpkg so maybe that’s it? We use wordpress also

Anyway, I downloaded the zip, made a “downloads” folder within the “assets” folder

Where do I put the “download.php”? Inside the assets folder? Any ideas what I’m missing?

Of course I can make a button that takes me to a landing page, but I’m wanting to do what you accomplished!
Thanks
Attachments
Folders.JPG
Folders.JPG (12.45 KiB) Viewed 2793 times
User avatar
Hopki
Gnome
Posts: 13015
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Guys,
If you want to download then just zip it up and use a Go-To URL action pointing to the zip file.
Or you can add this tag into a text box to force download the PDF.

Code: Select all

<a href="assets/test.pdf" download > Download my PDF </a>
Of if you want to click a button and not download from a hyperlinked text in a text box you can do this.
Add a text box to the skin and in the text field enter:

Code: Select all

<a href="assets/test.pdf" download id="pdf_1"> Download my PDF </a>
Note the ID, pdf_1.

Then hide the text box.
In your Download button add a Go To URL action with the URL:

Code: Select all

javascript:document.getElementById("pdf_1").click();
Again note where the ID is located, pdf_1 in the above code.
This will now call the "herf" call from the text box.

You can add as many as you need but make sure the ID's are different.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Norris Design
Posts: 4
Joined: Thu May 21, 2020 12:30 pm

Thanks for the help as always!!
I've gotten this to work where it downloads the content with a click!

I was hoping to make it so I didn't have to create a button for each image to download separately at the different nodes (and maybe you don't but I can't figure it out)

this project has been a humbling experience
Norris Design
Posts: 4
Joined: Thu May 21, 2020 12:30 pm

Something must be getting lost when it uploads to the website in the ggpkg

When I test locally it downloads perfectly fine, but when it's uploaded and I click the button it tells me "filename.htm" Failed - No File
Post Reply