0

I'm setting up an xml page in which I need to have just the file name of an image from a file upload field. What I currently have is:

<picture>
    {exp:xml_encode}{image}{/exp:xml_encode}
</picture>

but what this results in is:

<picture>
http://domain.com/uploads/images/11-january-006.jpg
</picture>

When what I only need is 11-january-006.jpg

any ideas on the best approach for this?

4

Use the file field tag pair:

{image}{file_name}{/image}

No add-on required!

| improve this answer | |
  • I can't believe I forgot about that option. – CreateSean Feb 9 '13 at 0:08
0

Does the filename variable not work for you?

{filename}
| improve this answer | |
  • Nate, nope but I found an addon that does what I need. Should've looked first before posting. devot-ee.com/add-ons/jco-get-file-info – CreateSean Feb 8 '13 at 22:21
  • 1
    That only works within the {exp:file:entries} tag, which has different syntax from the File fieldtype tag pair (for some crazy reason). – Derek Hogue Feb 8 '13 at 22:32
  • It's the easy questions that you need to slow down on before answering, nice catch :) – Natetronn Feb 8 '13 at 23:13

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.