[SOLVED] Upload pdf in backend and access url in frontend

(Tom Ole) #1

I have a property which looks like:

    type: 'Neos\Media\Domain\Model\Asset'
      label: i18n
        group: 'upload'

How to access to the url of the given file in the frontend? The docs only contain MediaHelper for images and thumbnails. https://neos.readthedocs.io/en/stable/References/ViewHelpers/Media.html

(Karsten Dambekalns) #2

For use in PHP, see Persistent Resources in the Accessing Resources section of the documentation.

In case you need this in Fusion, see Neos.Fusion:ResourceUri.

For Fluid, you were close, I think. See f:uri.resource

(Tom Ole) #3

Thanks for the reply.

I just tried but didnt get it work out. Can u provide a working example?

<f:if condition="{pdfUpload}">



I tried but didnt work out:

{f:uri.resource(ressource : pdfUpload)}

(Karsten Dambekalns) #4

Did you really try two s? It should be {f:uri.resource(resource : pdfUpload)}

(Tom Ole) #5

Yes you are right. My bad.

But unfortunately there was another mistake. As you can see here in the Persistent resource object example, you have to append .resource to the property.


The working result ends up in:
{f:uri.resource(resource : pdfUpload.resource)}

Thanks a lot. I appreciate your help.