wordpress - How to modify uploaded file URL in Gravity Forms using "gform_save_field_value" filter -
i want modify uploaded file url before saving database when user submits gravity form.
i trying acheive using "gform_save_field_value" filter in gravity form. when print fields inside filter function never file upload field id. other fields accessable inside filter function except file upload input field.
add_filter( 'gform_save_field_value', 'save_field_value', 10, 4 ); function save_field_value( $value, $lead, $field, $form ) { print_r($field); }
the gform_upload_path filter allow change upload path of file (and url).
add_filter( 'gform_upload_path', 'change_upload_path', 10, 2 ); function change_upload_path( $path_info, $form_id ) { $path_info['path'] = '/home/public_html/yourdomainfolder/new/path/'; $path_info['url'] = 'http://yourdomainhere.com/new/path/'; return $path_info; }
if need change actual name of file, here snippet makes cinch.
http://gravitywiz.com/rename-uploaded-files-for-gravity-form/
Comments
Post a Comment