ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

File manager: a reference to a file instead of a full URL?

January 21, 2011 8:11pm

Subscribe [2]
  • #1 / Jan 21, 2011 8:11pm

    John Morton

    84 posts

    I’m not sure how to phrase my question, so bare with me.

    I’m building a entry that uses a field that has a type of “file”. In that field, an admin can upload an image, a video, or a Flash file. In my template that renders this entry, instead of displaying that file, I would prefer to have a reference to that file (not the full URL of that file’s location) that I could use as a variable to pass to another page that would actually be the viewer for that file.

    I’m not sure that’s clear enough, but I want to create a link like this:

    <a href="http://site.com/flashviewer/1234/800/600">http://site.com/flashviewer/1234/800/600</a>

    In that case the 1234 would be a reference to the file that’s managed by EE because I don’t want a link that looks like this:

    <a href="http://site.com/flashviewer/http://site.com/uploads/flashfile.swf/800/600">http://site.com/flashviewer/http://site.com/uploads/flashfile.swf/800/600</a>

    Any thoughts? (I could break out PHP and a regular expression to do this, but I thought there might be a much simpler thing I’m overlooking.)

    Thanks.

    -John

  • #2 / Jan 21, 2011 11:18pm

    John Morton

    84 posts

    I see in the docs sort of what I might need in a way. It’s not an entry ID, but I can probably make it work. Any other thoughts welcome.

    From the docs:

    {news_image}

    The file field will contain the full url to the uploaded file. You may want to use parts of that path, such as the filename. In order to accommodate this you can use the field as a tag pair:

    {news_image}
    
        The file is a: {extension}
    
    {/news_image}

    The available variables are:
    {path} - the path to the parent folder
    {filename} - the name of the file
    {extension} - the file extension

  • #3 / Jan 23, 2011 4:52pm

    Greg Salt

    3988 posts

    Hi John,

    It looks like you have a way ahead for this so I’ll go ahead and close this thread. Please post back if required.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases