Link Vault
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5
Back to this add-on's main page
View Other Add-ons From Masuga Design
freeform auto download
Support (Resolved)
mac999
|
Posted: 13 October 2017 05:31 AM |
|
|
|
Hi
I have a file field type in my freeform entries
I export the entries to a csv file and add a link
mysite.ie/download/123
I have basic template
{exp:freeform:entries form_id=“3” status=”*” entry_id=”{segment_2}”}
{exp:link_vault:download_link file_name=”{freeform:field:cv}”}
{/exp:freeform:entries}
this works fine. I can click on the download link and it works
Is it possible that when i arrive at this template that the file is automatically opened/downloaded etc without havig to click on a link?
Thanks
|
|
|
Ben Kohl
|
Posted: 20 October 2017 02:53 PM |
# 1
|
|
|
You could add the url_only=“true” parameter to the Link Vault template tag and output the value of the template tag into a hidden input. Then have some JavaScript redirect to that input’s value on page load. I recommend doing it this way so there are no conflicts between parsing EE tags and JavaScript. Something like this:
{exp:freeform:entries form_id=“3” status=”*” entry_id=”{segment_2}”} <input type="hidden" id="redirect_url" value="{exp:link_vault:download_link file_name=”{freeform:field:cv}” url_only="true" }" > {/exp:freeform:entries}
...
$(document).ready(function() { window.loca tion.replace( $("#redirect_url").val() ); });
I haven’t tried something like this before but my concern would be that it might still render a blank page before the download starts.
|
|
|