Buy Now
Sign in

How to specify file name with user id

nams09 , July 03 at 04:03
n
nams09

Hello!

I'm not sure if this question has been posted before, but I couldn't find anything related.

I have an upload file action in chronoforms and I'd like the name of the file to contain the date and the id of the user that uploads it, can I do this with the "File name provider" option?

Thanks! :)

admin

Hi nams,

yes, you need to use the file name provider, how do you want the file to be named exactly ?

You could use this:

				
{user:id}-{date:YmdHis}.{var:upload_action_name.file.extension}

Replace "upload_action_name" with the name of the upload action.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

n
nams09

Thanks Max, I think that's what I need but I haven't been able to test i because my uploads aren't working.

If I'm trying to save data in CCv6 using a form I made in CFv6 and I have an upload action, do I need any special configuration? Everything saves to the database but my files aren't uploading :(

admin

Hi nams09,

it depends on your setup, if the fields and upload are handled by Chronoforms but not Connectivity then there is a setting to manage the upload automatically, assuming you have the latest version.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

n
nams09

Thanks Max. I'm still having problems with the uploads, I'll see if I can explain myself:

I have three fields which are called actanacimiento, constancia, boleta. So I need the names of the uploads to be <id>_<date>_actanacimiento.pdf, <id>_<date>_constancia.pdf, <id>_<date>_boleta.pdf or whatever the extension is.

I have three upload actions for each, but when I try to upload them it seems that only the first upload action works because I got two of the files uploaded but they're all called <id>_<date>_actanacimiento.pdf and <id>_<date>_actanacimiento.png

So, the only way I figured this was happening was because I uploaded different types of files.

Is this happening because I need to specify which upload action belongs to each field somehow?

admin

Hi nams09,

Only one upload action is needed in this situation, and in the file name provider you can use:

				{user:id}_{date:YmdHis}_{var:upload_action_name.file.name}_{var:upload_action_name.file.extension}
				


Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

n
nams09

Thank you so much Max! It's now working perfectly, but on chronoforms.

Now, my problem is I have a New button on Chronoconnectivity which is linked to this form, I used {chronoform/section:formatobecashijos/one} in the content field, it saves everything on the database except for the file names I gave them through the file name provider and it's not uploading them to the server either.

I have a save to database action in chronoforms, but how do I get Chronoconnectivity to save the form? I attached the configuration I have for the new button and where I call the form.

I really appreciate your help! :)

Attachments
formview.png
formview.png
(114.58 KiB)
90 Downloads/Views
newbutton.png
newbutton.png
(112.06 KiB)
90 Downloads/Views
admin

Hi nams09,

You display the Chronoforms section in your Connectivity form, but how do you process the form in Connectivity ? its pointed to the "edit" event, then what do you have in that event ? I suggest that you use Chronoforms to build the form interface only and use Connectivity for everything else, I mean for saving, uploading..etc, it has the same action configuration and features.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

n
nams09

It is working now, I added the upload function to the save event and everything works. Thank you so much Max, I'm still getting the hang of the new version but I think I'm getting there! :)