PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

upload files to show on specific page?

  1. Micki
    Member

    i have not found an answer to this. I have a client who would like to upload files (pdfs) to a page within site. Is there a way to have this happen using gravity form without physically going in and adding the links to the files on the page after they are uploaded? thanks for any insight you can provide...

    Posted 11 years ago on Wednesday June 27, 2012 | Permalink
  2. Gravity Forms can handle the upload and form submission. Then you will have to add some code to your theme's functions.php to update an existing page with the links to the uploaded PDFs. There are hooks built in to Gravity Forms to update the post. You probably want to use gform_after_submission http://www.gravityhelp.com/documentation/page/Gform_after_submission and then in your custom function call the wp_update_post function.

    It is a customization but the difficulty will depend on your comfort level with PHP.

    Posted 11 years ago on Wednesday June 27, 2012 | Permalink
  3. Micki
    Member

    Wow, thanks for the quick response... I will read the docs, and my confidence level is rather low at the moment, can't figure out where to add the code to change the GForm upload path. Thinking of just doing this for the moment and manually adding until I can try what you wrote above. Tried it in the child theme functions and all went white. Is this where I should be adding it?

    Specifying for one form only...

    [php]
    <?php
    add_filter("gform_upload_path_1", "change_upload_path", 10, 2);
    function change_upload_path($path_info, $form_id){
       $path_info["path"] = "/uploads/docs/";
       $path_info["url"] = "http://mysite/uploads/docs/";
       return $path_info;
    }
    ?>

    Am I way off :).

    Thanks!

    Posted 11 years ago on Thursday June 28, 2012 | Permalink
  4. In the child theme's functions.php is the correct place. Chances are you don't need the opening <?php and closing ?> - it depends on where you inserted it into the file. Can you post your complete functions.php at pastie.org or pastebin.com so we can help with the syntax error? Should be easy to spot. Thanks

    Posted 11 years ago on Thursday June 28, 2012 | Permalink
  5. Micki
    Member

    Hi, and thanks, yep, forgot to NOT add the php tags... duh.

    Posted 11 years ago on Thursday June 28, 2012 | Permalink

This topic has been resolved and has been closed to new replies.