The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Trying to file upload to specific folder by entry ID
Hi there,
I'm using this code to modify the destination of file upload. I'd like the file to be based on the entry ID of the uploads. So far I've placed this snippet as laid out here:
Should I be calling the entry ID into the function using the following somehow?
function frm_move_file_and_rename($entry_id) {
$entry = FrmEntry::getOne( $entry_id );
...
$new_folder_name = 'formidable/' . sanitize_title( $_POST['item_meta'][ 231 ] . '-' . $_POST['item_meta'][ 234 ] . '-' . $entry);
Thank you!
July 22, 2017 at 7:46 am
Using $entry in this context will produce an error. The $entry variable as returned from FrmEntry::getOne( $entry_id ); is a PHP object. Since you are receiving the $entry_id as a parameter of the function, there's no need to access FrmEntry::getOne. The last line should be:
$new_folder_name = 'formidable/' . sanitize_title( $_POST['item_meta'][ 231 ] . '-' . $_POST['item_meta'][ 234 ] . '-' . $entry_id);
Discussion closed.