Hi!
I’m trying to use the gform_pre_submission filter to set a field to 1 if a file has been uploaded but I’m not sure how to check if a file has been uploaded. This is what I currently have:
add_action('gform_pre_submission_96', function($form) {
$file_upload_field_id = 80;
$hidden_field_id = 83;
// Set field 83 1 if a file has been uploaded
// set to 0 o.w. (this isn't strictly necessary since the default value is 0 but "just in case")
if(!empty(rgpost('input_' . $file_upload_field_id))){
$_POST['input_' . $hidden_field_id] = '1';
}else{
$_POST['input_' . $hidden_field_id] = '0';
}
});
On submission, it enters the function but not the true part of the if statement. I’m thinking I need to check if a url exists but I’m not sure how to access it pre-submission. Multi-file upload is not enabled. Does anyone know what I should be using for the if statement?
Thanks!