Gravity PDF
[resolved] Display uploaded images (3 posts)

  1. ashbryant
    Posted 3 years ago #

    I hope someone can help me. I'm having trouble displaying images that I have uploaded via Gravity forms. How do I call on them?

    I have tried this

    $image = $form_data['file']['image upload'];

    but it doesn't work. How do I find the correct path to the upload?


  2. Jake Jackson
    Plugin Author

    Posted 3 years ago #

    Hi ashbryant,

    If you uncomment the print_r($form_data); line in the template file and then generate the template through the admin area you'll get the complete array.

    See Creating an Advanced Template under the plugin's documentation heading:

  3. ashbryant
    Posted 3 years ago #

    I tried that, but that's not the issue I have. It's getting the url to the file uploaded not echoing out the link to it.

    However I have come up with a solution, so to anyone else having the same issue this is what you need to do.

    Call the info as you have done before for any other field
    $file = $form_data['field']['Upload file'];

    After add this...

    $file_url = new SimpleXMLElement($file);

    Now echoing like this...

    <?php echo $file_url['href']; ?>

    Will echo out the url to that file, which you can add to a src="" for images or anything else you may need.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Gravity PDF
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic