Forums

Image File Name NOT Being Stored in Database

Tgoodrich 07 May, 2014
Hi,

I'm not sure what I'm doing wrong but I have a form made to upload contact information that will later be retrieved to populate another form.

One of the form fields is a file upload set to upload an image. I read that when an image is uploaded in chronoforms it will save the actual image file in chronoforms default directory and add the file name for that image to the database.

Most everything seems to work, image uploads to default directory as it should and most all form fields save to the database except for the image file name. In the database the the record is empty where the images file name should be.

Am i doing something wrong, missing a step or is it a database setting that needs to be changed.

In the database the column name is "uploaded_image", the type is set to "varchar(255)" but i also tried setting it to "text".

Please help
Tgoodrich 07 May, 2014
Answer
Hi Again,

I guess I jumped the gun on this one. I had been trying to figure this out for several hours with no luck. But I figured it out just 5 minutes after I made my first post lol.

Turns out the "DB Save" needs to go inside of the "File Upload" "On success".

Everything appears to be working properly now.
GreyHead 08 May, 2014
Hi Tgoodrich,

It should work OK as long as the DB Save is *after* the Upload Files action. I generally advise against using the On Success events unless logically necessary as it adds complexity to the form processing.

Bob
Tgoodrich 08 May, 2014
Hi Bob,

I'll try it as you have suggested. Thats one on the things about chronoforms I'm finding to be not very intuitive is the setups ordering of actions. For instance, lets take the "demo-basic-contact-captcha" form. If i built that form I would have put an email action inside the captcha on success. To me it would seem logical as before the form submits and sends and email it needs to check the captcha. If the captcha is successful then the email is sent. However that demo form actually puts the email action after the captcha in the on submit. At least thats how the ordering looks. Maybe its just me and my lack of understanding but for people like me it would be useful to have some kind of explanation on how the ordering works and what should go in the on success. The on fail seems easy to understand but at least for me, i do not know when something should go in the on success or not.

So really the form designer is very intuitive, but at least for me the form setup isn't.

Dont get me wrong here, its easy to see how powerful chronoforms is and how most anything can be done with it. I just wish there was more documentation for newbs like me.

Anyway, I'll report back when i've tried your suggestion.

Thanks
GreyHead 08 May, 2014
1 Likes
Hi Tim,

Either route will work. My thinking is to keep the main logic flow of the actions as un-nested as possible i.e. with the actions in the main parent event.

Logically, the 'On Success event' and the next 'On Submit' event are handled at the same point in the process *unless* there is some action in the 'On Success' event that changes the logic flow, a redirection for example.

This is a matter of taste and preference - flavoured in my case, by a few early actions where the on Success event didn't work. In my own CFv4 actions I tend to omit the On Success action completely unless it has a specific purpose.

There are a couple of CFv4 Basics documents on my site that look at events and actions in more detail. They are written for CFv4 but also apply in more or less the same way to CFv5.

Bob
Tgoodrich 09 May, 2014
Hi Bob,

Thanks for the explanation, that does clear things up a bit more.

I also wanted to report back that loading the actions the way you described also works well.

Kind Regards
This topic is locked and no more replies can be posted.