Display asset (name) in a submission overview #1688
Unanswered
FrDH
asked this question in
Questions & Answers
Replies: 2 comments 1 reply
-
Hi @FrDH, Can you try something like this instead? {% set assetId = form.get('myUploadField').value %}
<p>Here's the uploaded file(s):</p>
<ul>
{% for asset in craft.assets.id(assetId).all %}
<li>{{ asset.url }}</li>
{% endfor %}
</ul> Also, are you entering this into a Twig-enabled HTML block in the form builder, or something else? 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you for the suggestion, but unfortunately it does not out output anything (other than an empty UL). I changed the upload-directory to one with a public URL, but that didn't help. {% for field in allFields|filter(f => f.valueAsString and f.type in ['file', 'file_drag_and_drop']) %}
<dt>{{ field.label }}</dt>
<dd>
<!-- {{ field.valueAsString }} -->
{% for asset in craft.assets.id(field.valueAsString).all %}
url: {{ asset.url }}<br>
{% endfor %}
</dd>
{% endfor %}
</dl> Note that Thanks for any insights. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When trying this guide, is it possible to display anything that was uploaded to an asset/upload field?
https://docs.solspace.com/craft/freeform/v4/guides/dynamic-data/displaying-submission-data-from-previous-pages/
It's worth noting that all assets are uploaded to a "protected" directory, one that does not have a public URL. This can not change.
I tried something like this:
Beta Was this translation helpful? Give feedback.
All reactions