Upload and then save as new name?

parisi 24 Oct, 2007
I have not been able to find any comments on this. I want to allow a user to upload a file but I want to save it as a certain name based on the answers they put in the form.

For example a user uploads a photo of themselves, named me.jpg, I want it to be save to disk as FirstNameLastName.jpg.

How would I accomplish this?

Thanks in advance!!!

Paul.
Max_admin 24 Oct, 2007
Hi Paul,

this will need to hack chronocontact.php, find thisl ine :


$filename        = date('YmdHis').'_'.preg_replace('`[^a-z0-9-_.]`i','',$_FILES[$allowed_s2[0]]['name']);

change it to whatever you like.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
parisi 24 Oct, 2007
Awesome - thank you very much!!!!
parisi 24 Oct, 2007
One more question just came to mind. Is there a way to save the Joomla username, Joomla email address into the table as well, or get it into a hidden form field?
Max_admin 25 Oct, 2007
Hi Parisi,

use this code :


global $my;
echo $my->username;


Email must be get from the _users table using the record id with $my->id

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.