Help forcing image file download on click

Hey everyone,

I am trying to create an embed link where it directly downloads an image from my CMS.

Referring back to a related thread, Webflow disallows us from using the custom attribute “download” as it’s reserved for Webflow.

From what I gather, I can use an embed to accomplish this, but I am having trouble with the correct code.

For my CMS setup, I have a file field where I have upload the image I would like to be downloaded. The file name is the same as the “Name” field for the CMS item too if that’s helpful.

Here are the two embeds I have tried, but obviously they aren’t working because I am clueless over here:

Here is my read-only link and a link to the live staging site.

If anyone has a suggestion or can help, I would really appreciate it. Thanks!

I’d be curious about this as well as i’m needing to do something similar!

@myonke did you figure this out in the end?

Sorry @marklovin I did not :frowning:

The files hosted in webflow CDN won’t be published as “filename.png”, maybe that’s the issue.

You should try hosting the pics on a separate FTP folder and try with href=“https://yoursite.com/**(field:name)**.png

1 Like

This won’t work because Webflow is hosting the files at “https://assets.website-files.com/yourfile” - the “download” on the HREF won’t work unless the files are bring downloaded on the SAME URL… so if you site here yoursite.com - then the files would have to be yoursite.com/filename...not https://assets.website-files.com/filename… a big limitation on Webflow. Well…not big…but for this purpose… a bit annoying. I’m trying to click on an SVG and have that SVG download as a file…won’t happen.

1 Like