Support

Account

Home Forums General Issues File Upload – echo absolute path rather than full URL

Solving

File Upload – echo absolute path rather than full URL

  • Hello,

    I’m using JWPlayer with advanced custom fields. Works great so far, however I now require the the absolute path to the video (ie. /wp-content/uploads/2014/1/test.avi) rather than the full URL (ie https://www.site.com/wp-content/uploads/2014/1/test.avi) to be echoed.

    Note that this will obviously use WordPress’s folder naming schemes so every month, it will be in a different folder (ie. uploads/2014/1, uploads/2014/2 etc)
    I use the file upload fields for HD and SD versions of the videos.

    Is this something easily achieved? I normally try to figure things out myself, however this ones got me scratching my head!

    Regards

    James

  • How are you currently echoing out the URL?

  • Hi @deset

    This thread contains some code to replace the URL with the PATH:
    http://wordpress.org/support/topic/full-path-to-attachment-images

    You could use this in combination with the get_field() function to:
    1. Get the ACF value
    2. If the value is an array or ID, load the URL
    3. Use the function (in linked thread) to replace the URL with the PATH
    4. echo the result of the function

    Thanks
    E

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘File Upload – echo absolute path rather than full URL’ is closed to new replies.