<p>Well, I figured out a way to do this. This works.</p>

<pre><code>{% set file = variant.songFile.one() %}
{% if file %}
  &lt;form method="post" target="_blank"&gt;
    {{ getCsrfInput() }}
    &lt;input type="hidden" name="action" value="assets/download-asset" /&gt;
    &lt;input type="hidden" name="assetId" value="{{ file.id }}" /&gt;
    &lt;input type="submit" value="Download" /&gt;
  &lt;/form&gt;
{% endif %}
</code></pre>

<p>Courtesy of this old answer: <a href="https://craftcms.stackexchange.com/a/22850">https://craftcms.stackexchange.com/a/22850</a></p>

CC BY-SA 4.0
2019-01-21T03:48:21.270Z
2019-01-21T03:48:21.270Z
Marc Miller
<p>What's the best way to hide the URL from the user/browser task bar? The only way I can get the link to work for a customer is to select the "Assets have public URL", which I really would prefer not to.</p>

<p>Even though the link to the files are on a protected My Downloads page surrounded by If License, it wouldn't be hard for a knowledgeable internet user to start guessing other file paths. I already have the filenames closely related, but not exact to the product title and the products are in a subfolder by entry id. </p>

<p>A preferred way would be to have the product file directory be above the web root, but I can't seem to find any way to do that with the plugin as it is. Am I missing something?</p>

<p>I suppose I could just make my download folder a string of 30 random characters so at least you can't see the full URL in the bottom of a browser as it would get cut off. But a smart user could still copy the link to the clipboard.</p>

<p>I see there is the <a href="https://github.com/tikiatua/internal-assets-plugin" rel="nofollow noreferrer">Internal Assets</a> plugin that looks to do what I want, but it's based on User Permissions. So I assume I would have to write a plugin that assigns a user permission to a file once they get a license generated, but it would be nice to have that feature be a part of the Digital Products itself.</p>

<p>Any other options?</p>

<plugin-craftcommerce2><plugin-digitalproducts>
Hide or obfuscate Digital Product file path?
# Hide or obfuscate Digital Product file path?

(Asked by: username_0 on 2018-12-01)

What's the best way to hide the URL from the user/browser task bar? The only way I can get the link to work for a customer is to select the "Assets have public URL", which I really would prefer not to.

Even though the link to the files are on a protected My Downloads page surrounded by If License, it wouldn't be hard for a knowledgeable internet user to start guessing other file paths. I already have the filenames closely related, but not exact to the product title and the products are in a subfolder by entry id.

A preferred way would be to have the product file directory be above the web root, but I can't seem to find any way to do that with the plugin as it is. Am I missing something?

I suppose I could just make my download folder a string of 30 random characters so at least you can't see the full URL in the bottom of a browser as it would get cut off. But a smart user could still copy the link to the clipboard.

I see there is the [Internal Assets](https://github.com/tikiatua/internal-assets-plugin) plugin that looks to do what I want, but it's based on User Permissions. So I assume I would have to write a plugin that assigns a user permission to a file once they get a license generated, but it would be nice to have that feature be a part of the Digital Products itself.

Any other options?

**Tags:** plugin-craftcommerce2, plugin-digitalproducts

---

## 1 answers

### Answer by username_0 on 2019-01-21. Score: 0 | Accepted answer

Well, I figured out a way to do this. This works.
{% set file = variant.songFile.one() %}
{% if file %}
  
    {{ getCsrfInput() }}
    
    
    
  
{% endif %}

Courtesy of this old answer: https://craftcms.stackexchange.com/a/22850


---

