Forums

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

Carlos angel 16 Apr, 2018
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 21 Apr, 2018
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
Carlos angel 21 May, 2018
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 22 May, 2018
Answer
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
Carlos angel 22 May, 2018
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?
This topic is locked and no more replies can be posted.