# Upload file into a folder based on a field in the form

**URL:** <https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059>\
**Category:** Get Help\
**Tags:** gform\_upload\_path, has-ticket, gravity-wiz\
**Created:** [October 28, 2021, 7:21pm UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059 "2021-10-28T19:21:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![user611aff58d4a9b162](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@user611aff58d4a9b162](https://community.gravityforms.com/u/user611aff58d4a9b162)\
**Post date:** [October 28, 2021, 7:21pm UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/1 "2021-10-28T19:21:51Z")

</div>

I would like and uploaded file to be saved in a folder named after a field in the form (the age selected field) and then in that folder the name and surname (of the person that completed the form) then the Uploaded file

Server → wp-contents → uploads → gravityforms → Folder (age that was selected in gravityform) → Folder (Name and surname that was typed in on gravity form) → Uploaded file.jpg

Is that at all possible, I have a little free tool that does it, but I would like to use the gravity form instead - or is there an add-on that can be used?  
Thanks

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 28, 2021, 9:37pm UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/2 "2021-10-28T21:37:36Z")

</div>

Hi Lorinda. This can be done with the gform\_upload\_path filter:

> **[gform\_upload\_path](https://docs.gravityforms.com/gform_upload_path/)**
>
> This filter is executed before uploading a file (by the File Upload or Post Image fields). It can be used to change the location where uploaded files are stored.

Or, there is an add-on that can rename files according to your pattern (it does not create the folders, but could be used to rename the file in addition to using the filter to create the path):

> **[Rename Uploaded Files For Gravity Forms - Gravity Wiz](https://gravitywiz.com/rename-uploaded-files-for-gravity-form/)**
>
> Create a dynamic naming template for your uploaded Gravity Form files, including using merge tags to generate new file names from user input.

If you have any other questions, please let us know.

---

<div class="post-metadata">

**Author:** ![user611aff58d4a9b162](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@user611aff58d4a9b162](https://community.gravityforms.com/u/user611aff58d4a9b162)\
**Post date:** [October 29, 2021, 7:37am UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/3 "2021-10-29T07:37:01Z")

</div>

Thank you, Let me try these options, appreciate the quick assistance

---

<div class="post-metadata">

**Author:** ![user611aff58d4a9b162](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@user611aff58d4a9b162](https://community.gravityforms.com/u/user611aff58d4a9b162)\
**Post date:** [November 11, 2021, 11:46am UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/4 "2021-11-11T11:46:52Z")

</div>

Hi, I tried the add-on, but you have to buy this add on - was wondering if there is a way that one can just change the name of the uploaded file as it is uploaded to the name that was completed in the form, without paid plugins, I bought the Elite package. Is there any way to do this?  
Thank you

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [November 11, 2021, 4:08pm UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/5 "2021-11-11T16:08:28Z")

</div>

Hi Lorinda. This solution is free (not paid):

> **[Rename Uploaded Files For Gravity Forms - Gravity Wiz](https://gravitywiz.com/rename-uploaded-files-for-gravity-form/)**
>
> Create a dynamic naming template for your uploaded Gravity Form files, including using merge tags to generate new file names from user input.

The code is available here:

> <https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-gravity-forms-rename-uploaded-files.php>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [December 11, 2021, 4:08pm UTC](https://community.gravityforms.com/t/upload-file-into-a-folder-based-on-a-field-in-the-form/11059/6 "2021-12-11T16:08:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
