0

I have a grid field with rows containing files uploaded. These grid entries are output on a standard page but I need to access the filetype of the files uploaded and this only appears to be available in a '{exp:file:entries}' tag pair. How can I access the file_id of the uploaded files in each row of the grid field in order to use a tag like {exp:file:entries file_id="grid-row-file-id"}{filetype}{/exp:file:entries}

1 Answer 1

1

Have you tried a variable pair and the {file_id} variable inside it? But, by this way, you already have access to the mime type, using the {mime_type} variable.

{gallery}
    <figure>
        {gallery:image}
            <img src="{url}" height="{height}" width="{width}">
            <figcaption>mime type of file {file_id}: {mime_type}</figcaption>
        {/gallery:image}
    </figure>
{/gallery}
4
  • That's brilliant - I didn't know you could use the grid row as a tag pair inside the main grid field tag pair! Sep 2, 2016 at 21:37
  • I've tried this in 3.4.3 and it doesn't work. Within a grid the opening {gallery:image} tag is rendered as the image URL. I don't think it's possible to get the meta data of the file when it's within a grid unfortunately. Nov 3, 2016 at 17:05
  • @CraigDuarte, this looks like a bug to me.
    – Sobral
    Nov 3, 2016 at 20:57
  • @RobsonSobral you're right, this was a bug with 3.4.3, fine in 3.4.4. Thanks! Nov 16, 2016 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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