Getting Files To Automatically Start Download

Tourist
6 0 0

I am trying to make a button that when clicked, automatically starts the download of a pdf file. I have been experimenting with images but so far nothing seems to work. Currently here is the code I am working with:

 

<a href="https://cdn.shopify.com/s/files/1/2034/4709/files/Newsletter-Image_Main.png?5709" class="action_button" target="_blank" download="Our Free Guide">Download Here</a>

I am obviously missing something, do I need to upload the file to a different location? Do I need to link the file path from shopify? You can check it out right here: https://uniquecampingmarine.com/pages/test. Any help would be much appreciated!

 

Thanks!

 

 

0 Likes
Tourist
6 0 0

Have you been able to get that to work? Because even using their code doesn't seem to work... Should I be uploading my files to the assets folder instead of to files? I can get the download to prompt if I am linking to an asset, but when the download starts is says "no file".

 

Thanks!

0 Likes
Shopify Expert
96 17 12

@WillyAwesome - Can you pass over the code you used?  You can serve downloadable content via the "files" modules so seeing what you ended up with w/ help with any troubleshooting.

1 Like
Tourist
6 0 0

Yeah for sure!

 

I used this:

 

<a href="/assets/favicon.png" class="action_button" target="_blank" download="Our Free Guide">Download Here</a>

Just playing with it, it still won't download a file, even when I uploaded a different png to the asset files.

I am building the page right here if you want to view it live:https://uniquecampingmarine.com/pages/test

0 Likes