Image upload and DB edit

adamdidthis 03 Mar, 2008
Hi,

I am new to chrono forms and would like to know if I can create a form that would upload an image to a specified folder and then edit a DB table to tell my gallery component it's there. If this can be done, how id it done?
GreyHead 03 Mar, 2008
Hi adamdidthis,

The answers a qualified yes.

You can create a form that will upload an image no problem.

You'll need to hack the code, or write a code snippet to have it delivered to a specified folder. I haven't done this but it shouldn't be too much of a problem.

You'll also need some custom code to add it to the gallery database table but this also isn't too difficult to do.

Bob
adamdidthis 03 Mar, 2008
Thanks for that GreyHead, if you can point me in the direction of the code I need to hack I am sure I can handle it. Plus where do I put the table edit code?
GreyHead 03 Mar, 2008
Hi adamdidthis,

Thought about this after I posted. I think that you can do it all within ChronoForms without hacking the code.

ChronoForms uploads files to the com_chronocontact/uploads folder. That is done fairly early on so you can put a chunk of PHP in the 'OnSubmit before email' box to move the uploaded file a second time to your gallery folder. You'll find a model for the code in the handle_uploaded_files() function near the end of chronocontact.php. The file info is, I think, in the $attachments array.

Once the file is moved you'll need to write an INSERT or UPDATE command to update the appropriate database table. Again there's a model in the AutoGenerated tab of any form that's had a table created (create a dummy one with the right field names if you need to).

Bob
dakke 07 Apr, 2008
Would chronoforms be able to idd store some url like link, store some info of the user, some other data and show these data in a specified item?

Say you submit a form with username, bio, picture,... and want to store them in a DB table: possible using chronoengine?
Say you want to get that info and show them in an item 'itemPersonA' eg, can you do this using chronoengine?

Is chronoengine built to create forms and only forms, or can it also show the info/data uploaded with those forms?
GreyHead 07 Apr, 2008
Hi dakke,

Yes, you can collect data using forms and show it again using ChronoForms.

BUT ChronoForms is a Forms **Manager** that makes it simple to collect data and save it. ChronoForms itself does not provide any form code, nor any code to display the results. You have to provide that.

You can put almost any combination of php and html in the HTML code box and it will be displayed; it doesn't have to be a form. So you could easily make a 'form' that looks up the data in a database table and displays that.

Bob
Max_admin 08 Apr, 2008
Hi Dakke,

And you can use the profile plugin to show one record from any DB table very easily!

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.