The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Custom Upload Dir
[resolved] Gravity Forms Compatibility (5 posts)

  1. landwire
    Posted 4 years ago #

    Hi there,
    I would like to get this working with posts that get uploaded through gravity forms! At the moment the media files that GF creates are just added to the /uploads folder ingnoring all the settings I have made in CUD. It works fine for posts from the WP backendn though.

    Is there anyway that those two plugins can play together?
    Any help is appreciated,


  2. landwire
    Posted 4 years ago #

    Has anyone got those 2 plugins to work together? That would just be the bees knees....

  3. landwire
    Posted 4 years ago #

    After many hours I got the two to play. It's a minor hack for now and reapplied at each update in a few minutes. I hope to get it sorted without hack sooner or later...

  4. ulfben
    Plugin Author

    Posted 4 years ago #

    When using some other upload method (than the WordPress media library or admin backend), you must provide:

    $_REQUEST['Upload'] or $_REQUEST['html-upload'] (any non-empty value)

    And - if you want to support all of CUDs post-specific placeholders - provide:

    global $post
    global $post_id
    or $_REQUEST['post_id']

    The values are used in that priority.

    And lastly - Custom Upload Dir only applies if your upload function runs the upload_dir-filter.

  5. ulfben
    Plugin Author

    Posted 4 years ago #

    The new drag-n-drop uploader of WordPress 3.3 changed all this, as it provides neither of those flags (Upload / html-upload).

    With CUD 3.3 there is no checking for these. Instead the filter only registers to run while media_handle_upload is executing. media_handle_upload is a built-in WordPress function and handles the file upload POST itself, creating the attachment post.

    Thus; when using custom upload methods, make sure they put the files through that function or CUD will have no effect.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Upload Dir
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic