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.

File Renaming with 1.64 beta

  1. I just read in the forum that the latest beta release of Gravity Forms allows file renaming and nicely formatted URLS of uploaded images. I don't however, see any documentation on this feature and, after installing the beta version, I don't see any options in the Upload item that allows me to change file name.
    Your demo site has a sample that allowed me to upload an image with an 'ugly' filename and then it sent me an email with the nicely formatted name.
    How can I implement this?

    I have tried to use the PHP that was posted at http://www.gravityhelp.com/forums/topic/renaming-uploaded-files-before-saving. I added this to my themes functions.php and in the debug text, it clearly shows that it finds the original file, and shows me the nicely formatted name I want to give it, but the function fails with a 'cannot find file in directory' error.

    At the end of that post, I read that eventually, file renaming functionality will be added but likely will just be a hook, instead of in the UI, as 'not many users will need this functionality'. I strongly disagree with that idea. Including keywords in image file names is an important part of good SEO practices, and this is why it is so important to ensure that images that users upload have their filenames changed.

    Other than that big request, let me say that I LOVE Gravity Forms.

    Posted 11 years ago on Monday April 30, 2012 | Permalink
  2. Where did you read that the latest beta release includes hooks for file renaming and formatted URLS of uploaded images? I'm not aware of those hooks being added yet and neither is anyone here. Can you point me to the support forum post where you saw this mentioned?

    Posted 11 years ago on Monday April 30, 2012 | Permalink
  3. I'm referring to the post by Chris Hajer at http://www.gravityhelp.com/forums/topic/replace-unwanted-characters-from-file-upload#post-35546
    He states

    The 1.6 version which is currently in beta 3 and available on the download page does a better job at renaming the files. You can try uploading your file here and see what the link looks like in your email confirmation:"

    Posted 11 years ago on Monday April 30, 2012 | Permalink
  4. Chris was correct that v1.6 did change some things related to file names and how it handles special characters. However, it did not implement hooks related to renaming the files and currently there are no hooks related to changing the filename.

    There is a hook related to uploading files to a custom location that you specific via the hook, but filenames are not changes when uploaded unless a duplicate exists... in which case it appends a numeric value at the end of the filename to denote a duplicate.

    Posted 11 years ago on Monday April 30, 2012 | Permalink
  5. I have a custom PHP script I built for my own uploader (completely independent of Gravity Forms) that works perfectly for renaming an image that a user uploads. Is it possible for me to call this script after the Gravity uploader completes its task?

    Posted 11 years ago on Monday April 30, 2012 | Permalink
  6. David Peralty

    Sure, check out the following:
    http://www.gravityhelp.com/documentation/page/Gform_pre_submission
    http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter
    http://www.gravityhelp.com/documentation/page/Gform_upload_path

    Hopefully those hooks will give you everything you need to make your PHP script work with Gravity Forms.

    Posted 11 years ago on Tuesday May 1, 2012 | Permalink

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