<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums User Favorites: jessicasantacruz</title>
		<link><a href='https://legacy.forums.gravityhelp.com/profile/jessicasantacruz'>jessicasantacruz</a></link>
		<description>Gravity Support Forums User Favorites: jessicasantacruz</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:14:01 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/profile/" rel="self" type="application/rss+xml" />

		<item>
			<title>Wired on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-231725</link>
			<pubDate>Wed, 01 May 2013 01:32:21 +0000</pubDate>
			<dc:creator>Wired</dc:creator>
			<guid isPermaLink="false">231725@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've just hit this problem too. The previously published solution is complex, and involves modifying the  DB after the lead record has been written. This also - as we now know - takes place too far down the track to affect anything in the notification emails and - often - data sent to other plugins.&#60;/p&#62;
&#60;p&#62;Instead, as suggested above, I hooked into the much earlier &#34;gform_pre_submission_filter&#34;, which triggers when the form is POSTed back, and before any processing is done. The code below is pretty basic (it'll run on every form - if you need something more specific, add a form filter check at the start) and just loops through the $_FILES array, replacing any filename it finds with a pseudo-random MD5 hash. (You could, obviously, replace this with any algorithm you wish to generate the filename.) &#60;/p&#62;
&#60;p&#62;However, remember that as this happens long before the DB write, you don't have access to a Lead ID or any other DB-related data; any other submitted form data you want to use will have to be got the old-fashioned way directly from $_POST - be careful to properly escape any field you plan to redisplay or use in an unexpected way to avoid the creation of potential XSS or SQL-injection vulnerabilities.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Force uploaded filenames to a unique hash BEFORE form is processed
add_filter(&#38;quot;gform_pre_submission_filter&#38;quot;, &#38;quot;wired_set_upload_filenames&#38;quot;, 10, 1);
function wired_set_upload_filenames($form)
{
 	foreach($_FILES as &#38;amp;$file)
	{
		$oldname = $file[&#38;#39;name&#38;#39;];
		$newname = $oldname;
		$ext = &#38;#39;&#38;#39;;
		$dot = strrpos($oldname,&#38;#39;.&#38;#39;);
		if ( false !== $dot )
		{
			$ext = substr($oldname,$dot);
			$newname = md5( mt_rand().$oldname );
		}
		$file[&#38;#39;name&#38;#39;] = $newname . $ext;
	}
    // Return form object
    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Hope this is of help to others in the same boat.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>InternalWealth on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-151624</link>
			<pubDate>Thu, 21 Feb 2013 11:51:46 +0000</pubDate>
			<dc:creator>InternalWealth</dc:creator>
			<guid isPermaLink="false">151624@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Anyone will to give me a hand with this? :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>InternalWealth on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-143271</link>
			<pubDate>Wed, 06 Feb 2013 08:24:04 +0000</pubDate>
			<dc:creator>InternalWealth</dc:creator>
			<guid isPermaLink="false">143271@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Sorry for the extremely late response. Here is my code that I am using for this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_post_submission&#38;quot;, &#38;quot;rename_file&#38;quot;, 10, 2);
function rename_file($entry, $form){

    //---------------------------------------------------------
    //---------------------------------------------------------
    //REPLACE THESE THREE VARIABLES BASED ON YOUR ACTUAL IDs
    $form_id = &#38;quot;1&#38;quot;;
    $fileupload_field_id = &#38;quot;6&#38;quot;;
    $name_field_id = &#38;quot;1&#38;quot;;
    //---------------------------------------------------------
    //---------------------------------------------------------

    //ignore other forms
    if($form[&#38;quot;id&#38;quot;] != $form_id)
        return;

    $upload_info = wp_upload_dir();

    //original name/path
    $original_file_url = $entry[$fileupload_field_id];
    $original_file_path = str_replace($upload_info[&#38;quot;baseurl&#38;quot;], $upload_info[&#38;quot;basedir&#38;quot;], $original_file_url);
    $original_file_info = pathinfo($original_file_url);

    //New File Name (without extension).
	$nospaces = $entry[$name_field_id];
	$nospaces = ucwords(strtolower($nospaces));
	$nospaces = str_replace(&#38;#39; &#38;#39;, &#38;#39;&#38;#39;, $nospaces);
    $new_name = &#38;quot;TS-&#38;quot; .  $nospaces . &#38;quot;_&#38;quot; . $entry[&#38;quot;id&#38;quot;];

    //adding same extension as original
    $new_name .= &#38;quot;.&#38;quot; . $original_file_info[&#38;quot;extension&#38;quot;];

    $new_file_url = str_replace($original_file_info[&#38;quot;basename&#38;quot;], $new_name, $original_file_url);
    $new_file_path = str_replace($original_file_info[&#38;quot;basename&#38;quot;], $new_name, $original_file_path);

    //rename file
    $is_success = rename($original_file_path, $new_file_path);

    //if file was renamed successfully, updating entry so that it points to the new file
    if($is_success){
        global $wpdb;
        $wpdb-&#38;gt;update(RGFormsModel::get_lead_details_table_name(), array(&#38;quot;value&#38;quot; =&#38;gt; $new_file_url), array(&#38;quot;lead_id&#38;quot; =&#38;gt; $entry[&#38;quot;id&#38;quot;], &#38;quot;value&#38;quot; =&#38;gt; $original_file_url));
    }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The Meta name for the field in the custom post type is &#34;sample-upload&#34;&#60;/p&#62;
&#60;p&#62;Thank you
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-136309</link>
			<pubDate>Wed, 30 Jan 2013 09:18:14 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">136309@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm not sure how you can do this then, since the gform_after_submission code will run after the notifications have been sent.  Did you come up with any other workarounds?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jessicasantacruz on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-131548</link>
			<pubDate>Fri, 25 Jan 2013 14:57:15 +0000</pubDate>
			<dc:creator>jessicasantacruz</dc:creator>
			<guid isPermaLink="false">131548@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Chris,&#60;br /&#62;
I am using the exact code from this link:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/file-upload-location-and-name#post-76119&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/file-upload-location-and-name#post-76119&#60;/a&#62;&#60;br /&#62;
I just changed the references to form 9 to 1.&#60;/p&#62;
&#60;p&#62;I would like to have the files renamed using the id# because the uploaded files from each submission are tests that need to be evaluated anonymously as well as easily linked to the database submission. The uploaded file that is attached to the notification email is what my client would like to use as her reference to the file rather than logging into the WordPress admin since she is not involved with the site itself in any other way.&#60;/p&#62;
&#60;p&#62;Please let me know if you need anything further from me.&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Jessica
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-124356</link>
			<pubDate>Thu, 17 Jan 2013 09:19:03 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">124356@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You won't be able to change the file name with the gform_after_submission code since the notifications have already been sent out.  You could use the gform_pre_submission_filter and work with the $_FILES global, which will contain the file name and the temp directory where the image is located before it's moved.  However, I have not seen anyone post the code to perform that customization and I've never done it myself.  Can you post the code you are using the change the file name now so we can see what you're trying to accomplish?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jessicasantacruz on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-119730</link>
			<pubDate>Fri, 11 Jan 2013 20:20:39 +0000</pubDate>
			<dc:creator>jessicasantacruz</dc:creator>
			<guid isPermaLink="false">119730@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Chris,&#60;br /&#62;
Here is where the form is currently:&#60;br /&#62;
&#60;a href=&#34;http://awo.aws.org/professional-program-abstract-form/&#34; rel=&#34;nofollow&#34;&#62;http://awo.aws.org/professional-program-abstract-form/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;It's just been uploaded a few days ago so I do not have many files to rename at this point, but would like to have this functionality in place for the future. &#60;/p&#62;
&#60;p&#62;Thanks Chris,&#60;br /&#62;
Jessica
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-119713</link>
			<pubDate>Fri, 11 Jan 2013 19:00:42 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">119713@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The gform_after_submission code will be run after the form is submitted, the entry is created, and the notifications are sent.  That is probably not what you're looking for.&#60;/p&#62;
&#60;p&#62;Can you share a link to the form embedded on your site so we can see how many files you need to rename and what the notification looks like now?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jessicasantacruz on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-119594</link>
			<pubDate>Fri, 11 Jan 2013 14:32:29 +0000</pubDate>
			<dc:creator>jessicasantacruz</dc:creator>
			<guid isPermaLink="false">119594@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Chris,&#60;br /&#62;
I am new to Gravity Forms and was able to rename my upload file using the info in this post:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/forums/topic/file-upload-location-and-name#post-76119&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/file-upload-location-and-name#post-76119&#60;/a&#62;. It looks great when I log into the WP admin and view the entry, but the problem is that the file name and link in the notification email sent to the client is not updated with the new file name.&#60;/p&#62;
&#60;p&#62;Please let me know if there is a way to change the link and filename within the notification also.&#60;/p&#62;
&#60;p&#62;Thank You for your help,&#60;br /&#62;
Jessica
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Renamed file upload to update in custom post type"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/renamed-file-upload-to-update-in-custom-post-type#post-83462</link>
			<pubDate>Wed, 24 Oct 2012 22:06:47 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">83462@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Please share the code you are using the rename the uploaded file.  We can incorporate changing the custom field after the form submission using the gform_after_submission hook.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;(The old example used gform_post_submission, but that hook is deprecated and gform_after_submission is the replacement.)&#60;/p&#62;
&#60;p&#62;We will need to know the meta key name of the field where you are storing the file name so we know what to update.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
