Buy Now
Sign in

How to rename the file to username and the current date?

Carlos angel , April 16 at 15:06
C
Carlos angel
Hi.​
​I need help.​
​When a user submits a file, I need this file to be renamed to the name of the user it is sending and the current upload date.​
​​
​Thank you to anyone who can help me.
GreyHead
Hi Carlos angel,
You can use the File Name provider box in the Upload files action to set a custom name. I think that you can use any of the CFv6 shortcodes in there.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
C
Carlos angel
Hi, Gray.
I've already tried using the option that chromoforms to rename the files while uploading them, but I could not.
I do not know how to use php to be able to do a function that does rename the file. But if you can help me in this, I thank you very much.
GreyHead
Hi Carlos angel,
Please try using a string like this in the File Name Provider box of the Upload Files action
{var:upload6.file.name}_{user:username}_{date:Y-m-d_H:i}.{var:upload6.file.extension} 
Replace upload 6 with the name of your Upload Files action. Note that you may need to make sure that there are no spaces in the name depending on what you want to do with it.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
C
Carlos angel
Hi, Grey.​
​​
​Thanks for helping me. You helped me do what I needed. Sorry for the inconvenience, but I'm still learning to mess with chronoforms.​
​​
​Just one more thing. Is there a way to create a directory as soon as the user uploads a file for the first time?