Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Created March 13, 2015 18:31
Show Gist options
  • Save kjohnson/1ce48988ba04cb1c433e to your computer and use it in GitHub Desktop.
Save kjohnson/1ce48988ba04cb1c433e to your computer and use it in GitHub Desktop.
File Renaming Help Tab Text for Ninja Forms File Uploads
If you leave the advanced rename box empty, the uploaded file will retain the original user's filename. (With any special characters removed.)
If you want to rename the file, however, you can. These are the conventions that Ninja Forms understands, and their effect.
%filename% - The file's original filename, with any special characters removed.
%formtitle% - The title of the current form, with any special characters removed.
%username% - The WordPress username for the user, if they are logged in.
%userid% - The WordPress ID (int) for the user, if they are logged in.
%displayname% - The WordPress displayname for the user, if they are logged in.
%lastname% - The WordPress lastname for the user, if they are logged in.
%firstname% - The WordPress firstname for the user, if they are logged in.
%date% - Today's date in yyyy-mm-dd format.
%month% - Today's month in mm format.
%day% - Today's day in dd format.
%year% - Today's year in yyyy format.
Any characters other than letters, numbers, dashes (-) and those on the list above will be removed. This includes spaces.
An Example: %date%-%filename%
Would Yield: 2011-07-09-myflowers.jpg
@trueqap
Copy link

trueqap commented Feb 20, 2019

%field_X% where X is the ID of the field you would like to use to rename the file. You can find the ID by viewing the form through the preview and using the Inspect Element on the field you would like to use. Ex: If the ID is “nf-field-4”, you would use %field_4% .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment