A
Anonymous
Guest
Hi there,
I need help with renaming file after it has been attached using wordpess contact form 7.
Here is what is already working:
....
file_put_contents(ABSPATH. "import.txt", $output);
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('myfile', ABSPATH. '/import.txt');
endif;
This normally works and I receive attached file called "import.txt"
What I want is to attach unique name with date command.
I got file saved with date command, but I don't know how to attach it, please see below:
....
file_put_contents(ABSPATH. date('YmdHis') . ".txt", $output);
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('myfile', ABSPATH. '/import.txt');
endif;
}
Above generates file name with date like for example: 20202201093200.txt which is exactly what I want.
Thing is I don't know how to attach that file to an email.
Could someone see if it's possible to attach it?
Thank you in advance.
Regards,
Ivan
I need help with renaming file after it has been attached using wordpess contact form 7.
Here is what is already working:
....
file_put_contents(ABSPATH. "import.txt", $output);
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('myfile', ABSPATH. '/import.txt');
endif;
This normally works and I receive attached file called "import.txt"
What I want is to attach unique name with date command.
I got file saved with date command, but I don't know how to attach it, please see below:
....
file_put_contents(ABSPATH. date('YmdHis') . ".txt", $output);
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('myfile', ABSPATH. '/import.txt');
endif;
}
Above generates file name with date like for example: 20202201093200.txt which is exactly what I want.
Thing is I don't know how to attach that file to an email.
Could someone see if it's possible to attach it?
Thank you in advance.
Regards,
Ivan