• Skip to main content
  • Skip to primary sidebar

Victor Font Consulting Group, LLC

The DEX Intranet Specialists

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network

Formidable Pro Rename Upload File

December 4, 2015 By Victor M. Font Jr.

Formidable Pro Rename Upload File-public domain image from pixabay.com
As of the release of Formidable Pro V2.02, the process described in this article will no longer work. The Formidable Pro developers abandoned the standard WordPress upload functions in favor of a drag and drop jQuery Ajax uploader. While this is more efficient, it offers significant challenges because the files are uploaded before the form is submitted. When time permits, I'll look into a method for renaming files with this new process. In the meantime, the original article is below and will work with Formidable Pro versions released prior to V2.02.

When Michael Jenson needed help customizing the name of image uploads through a Formidable Pro form, Stephanie Wells of Strategy 11, the author of Formidable Pro, recommended that he contact us for assistance. We do a lot of custom Formidable Pro work and know the product well. Michael's form is located at http://cameraclub.photos/exhibition-upload/. His request:

What I’m looking for is to take all of the fields from this form (except email address) and use them to rename a jpeg image file upon upload. I have several clients who are camera clubs and they are requesting this functionality.

This is a screen print of Michael's form:

Exhibition Upload Form

To clarify the requirement, I responded:

So let’s say I upload an image in category aa, you want the image name to be: victor-font-aa-imagename-open-digital.jpg. Is that correct?

Michael confirmed his requirement and shortly thereafter, I sent the following code to him for testing with instructions to copy it into his child theme's functions.php file.

rename_imagehttps://gist.github.com/vfontjr/199632e7e3d1447c4aeb0510e1b25dec#file-rename_image-php

Michael's response:

This worked awesome!

This Can Work With Most Any Form

The beauty of this code is that with a little modification it could work with any form that uses the WordPress upload process as Formidable Pro does. You would have to determine how your form tool identifies its forms and the naming convention for the fields. The code intercepts and sanitizes the filename just before WordPress saves it. If you need help, you can always reach out to us.

To learn more about PHP's pathinfo() function visit: http://www.w3schools.com/php/func_filesystem_pathinfo.asp
To learn more about the sanitize_file_name filter visit: https://codex.wordpress.org/Function_Reference/sanitize_file_name
  • 1share
  • Facebook0
  • Twitter0
  • Pinterest0
  • LinkedIn1
  • Print
  • SMS0

Filed Under: Code Snippet, Formidable Forms, WordPress Tagged With: Code Snippet, Formidable Forms, WordPress

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Primary Sidebar

Shopping Cart

Books

  • Ultimate Guide to the SDLC front cover The Ultimate Guide to the SDLC
    Rated 5.00 out of 5
    $74.95
  • Winning With WordPress Basics 2nd Edition Winning With WordPress Basics 2nd Edition $19.95

Recent Articles

  • Modern Scam Defense: How Consumers and Businesses Can Recognize and Stop Email, Phone, and Text Fraud
  • How to Write a PRD So Dense It’s Technically a Novel
  • Top 5 Plugin Names That Scare Our Legal Department
  • When Agile Meets Our 3-Year Waterfall Roadmap: A Love Story
  • Why Our Enterprise Needs 27 Stakeholders to Approve a Button Color Change

Top 10 Article Categories

Best Practice Code Snippet Computers and Internet Genesis How To Leadership Programming Servant Leadership Tutorial WordPress

 
We only use analytical cookies on our website that allow us to recognize and count the number of visitors, but they do not identify you individually. They help us to improve the way our website works. By clicking Accept you, agree to cookies being used in accordance with our Cookie Policy.