<p><code>image.filename</code> should work unless I'm missing something. Note that it is case-sensitive.</p>

<p>The documentation on <code>AssetFileModel</code> can be found here:
<a href="http://buildwithcraft.com/docs/templating/assetfilemodel" rel="noreferrer">http://buildwithcraft.com/docs/templating/assetfilemodel</a></p>

CC BY-SA 3.0
2015-04-23T18:57:49.787Z
Of course the one variation I did not try was all lowercase. Sigh. That worked. Thanks for answering!
user2056505
CC BY-SA 3.0
2015-04-23T18:58:40.860Z
It's always that way for me. Sometimes it just takes another set of eyes. Happy to help!
Peter Tell
CC BY-SA 3.0
2015-04-23T18:55:01.543Z
2015-04-23T18:56:15.237Z
2015-04-23T18:56:15.237Z
Peter Tell
<p>I'm trying to get the actual file name of each images when looping through the image assets folder, which looks like:</p>

<pre><code>{% for image in craft.assets.kind('image').folderId('1').order('filename') %}
    &lt;li&gt;&lt;a href="#"&gt;&lt;img src="{{ image.getUrl() }}" alt="{{ image.title }}"&gt;&lt;/a&gt;&lt;/li&gt;
{% endfor %}
</code></pre>

<p>I need to be able to include the filename of the image as a data attribute in the <code>&lt;a&gt;</code> tag. I tried all sorts of variations of {{ image.fileName }} but have had no luck. Can't find a solution searching here. Does anyone know how? Better yet - is there a documentation somewhere showing all the available twig attributes for assets/images?</p>

<templating><assets>
Get Asset Image File Name
# Get Asset Image File Name

(Asked by: username_0 on 2015-04-23)

I'm trying to get the actual file name of each images when looping through the image assets folder, which looks like:
{% for image in craft.assets.kind('image').folderId('1').order('filename') %}
    
{% endfor %}

I need to be able to include the filename of the image as a data attribute in the  tag. I tried all sorts of variations of {{ image.fileName }} but have had no luck. Can't find a solution searching here. Does anyone know how? Better yet - is there a documentation somewhere showing all the available twig attributes for assets/images?

**Tags:** templating, assets

---

## 1 answers

### Answer by username_1 on 2015-04-23. Score: 8 | Accepted answer

`image.filename` should work unless I'm missing something. Note that it is case-sensitive.

The documentation on `AssetFileModel` can be found here:
<http://buildwithcraft.com/docs/templating/assetfilemodel>

> **Comments:**
> **username_0**: Of course the one variation I did not try was all lowercase. Sigh. That worked. Thanks for answering!  
> **username_1**: It's always that way for me. Sometimes it just takes another set of eyes. Happy to help!  

---

