Title: Set Attachment Path Programmatically
Last modified: August 30, 2016

---

# Set Attachment Path Programmatically

 *  [radmkt](https://wordpress.org/support/users/radmkt/)
 * (@radmkt)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/set-attachment-path-programmatically/)
 * Hi there,
 * First off, great plugin!
 * We would like to know if we can set the file path programmatically, specifically:
 * We are using custom post types with custom fields for a file. On each of these
   custom post types, we have a gravity form (same form each time).
 * What we would like to know is if / and how it would be possible to set the file
   path of the form attachment based on the custom field on each respective custom
   post type. In other words, we could use the same form, but the attachment would
   vary based on the CPT (instead of having to make loads of unique forms).
 * Thanks in advance!
 * [https://wordpress.org/plugins/gravity-forms-notification-attachments/](https://wordpress.org/plugins/gravity-forms-notification-attachments/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Henry D.](https://wordpress.org/support/users/henryleo/)
 * (@henryleo)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/set-attachment-path-programmatically/#post-6592461)
 * I have a very similar request… needing dynamic file attachments based on a custom
   field value.
 * I have a select field that is dynamically populated with data from a custom field(
   ACF Repeater). Each option in the dropdown is a URL to an uploaded file.
 * Would it be possible to use these files as the chosen attachment?
 *  [4briang](https://wordpress.org/support/users/4briang/)
 * (@4briang)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/set-attachment-path-programmatically/#post-8147668)
 * I’m hoping to find a solution very similar to what [@henryleo](https://wordpress.org/support/users/henryleo/)
   describes except I would like to base the attachments on selected checkboxes 
   within the form entry allowing the user to select which attachments they want
   to receive.
 * I can do it with the built-in gravity forms conditional logic but with 5 choices
   there would be 31 permutations.
 * Thanks in advance for any thoughts.
 * -Brian
 * PS – your donate button on the plugin goes to example.com

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Set Attachment Path Programmatically’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gravity-forms-notification-attachments_7db133.
   svg)
 * [Gravity Forms: Notification Attachments](https://wordpress.org/plugins/gravity-forms-notification-attachments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-notification-attachments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-notification-attachments/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-notification-attachments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-notification-attachments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-notification-attachments/reviews/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [file path](https://wordpress.org/support/topic-tag/file-path/)
 * [programmatically](https://wordpress.org/support/topic-tag/programmatically/)

 * 2 replies
 * 3 participants
 * Last reply from: [4briang](https://wordpress.org/support/users/4briang/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/set-attachment-path-programmatically/#post-8147668)
 * Status: not resolved