1

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 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?

0

Well, I figured out a way to do this. This works.

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.