Hi, guys.
Here is my issue.
I've created a form in CFv5 and DB table 'mv2_publications' for it to store information about publications, its authors and conferences IDs those publications are related to. As for the conferences there was created a proper table "mv2_conferences".
Then i've created a connection with main model "Publication" in CCv5 due to this faq (http://chronoengine.com/faqs/72-ccv5/5208-connectivity-edit-with-chronoforms.html) in order my form would be opened through a connection view list to edit all necessary data.
So, here is my form fields with its names:
textbox - Publication[publication_title];
textbox - Publication[author_1] ... and 5 more fields like this one Publication[author_ 2] and so on;
dropdown - Publication[conf_id] - this field takes its names and values from DBRead action Model (as a result i have a dropdown list of conferences i wish to link my publication record to. The conferences data are stored in a DB table "mv2_conferences");
and, of course, i haven't forgot about
a hidden field - Publication[publ_id] - to store ID of currently edited publication record.
In my DB table "mv2_publications" i have all necessary fields:
publ_id
publication_title
author_1, ... , author_6
conf_id
My actions panel:
onLoad{
DBRead - for making Model for the dropdown- Publication[conf_id]
HTML(RenderForm)
}
onSubmit{
ConnectionAction
}
In described case with this set of actions and form elements all works perfect: the form is opened through through a connection view list of publications when i want to edit an existing record or save a new one into the DB.
The next step i wish to take is adding a file upload ability to my form. I want to upload publications files to the server and save their names in "mv2_publications" DB.
First, for this purpose i've added one more field to my DB and named it "fil".
Then i've inserted "Files Upload" action into onSubmit block just before ConnectionAction. Then i have changed its Files Config field value to Publication[fil]:doc.
I've added a new File Field element to my form an named it "Publication[fil]".
I've tested my form entered through the connection list view. As a result all entered was saved in DB except filename. Moreover the file was not uploaded to the server.
OK, i've changed Publication[fil] field name both in File Field and in Files Upload action simply to "fil". As a result the file was uploaded to the server (i found it in chronoforms default 'uploads' folder), but its name wasn't saved in database.
And that is my problem. I've read all the faqs and forum topics about the similar issue, but there were no topics about file upload with CFv5+CCv5 joint use and it seems to me i'm deadlocked.
Please, help me if you can. I would really appreciate.
Here is my issue.
I've created a form in CFv5 and DB table 'mv2_publications' for it to store information about publications, its authors and conferences IDs those publications are related to. As for the conferences there was created a proper table "mv2_conferences".
Then i've created a connection with main model "Publication" in CCv5 due to this faq (http://chronoengine.com/faqs/72-ccv5/5208-connectivity-edit-with-chronoforms.html) in order my form would be opened through a connection view list to edit all necessary data.
So, here is my form fields with its names:
textbox - Publication[publication_title];
textbox - Publication[author_1] ... and 5 more fields like this one Publication[author_ 2] and so on;
dropdown - Publication[conf_id] - this field takes its names and values from DBRead action Model (as a result i have a dropdown list of conferences i wish to link my publication record to. The conferences data are stored in a DB table "mv2_conferences");
and, of course, i haven't forgot about
a hidden field - Publication[publ_id] - to store ID of currently edited publication record.
In my DB table "mv2_publications" i have all necessary fields:
publ_id
publication_title
author_1, ... , author_6
conf_id
My actions panel:
onLoad{
DBRead - for making Model for the dropdown- Publication[conf_id]
HTML(RenderForm)
}
onSubmit{
ConnectionAction
}
In described case with this set of actions and form elements all works perfect: the form is opened through through a connection view list of publications when i want to edit an existing record or save a new one into the DB.
The next step i wish to take is adding a file upload ability to my form. I want to upload publications files to the server and save their names in "mv2_publications" DB.
First, for this purpose i've added one more field to my DB and named it "fil".
Then i've inserted "Files Upload" action into onSubmit block just before ConnectionAction. Then i have changed its Files Config field value to Publication[fil]:doc.
I've added a new File Field element to my form an named it "Publication[fil]".
I've tested my form entered through the connection list view. As a result all entered was saved in DB except filename. Moreover the file was not uploaded to the server.
OK, i've changed Publication[fil] field name both in File Field and in Files Upload action simply to "fil". As a result the file was uploaded to the server (i found it in chronoforms default 'uploads' folder), but its name wasn't saved in database.
And that is my problem. I've read all the faqs and forum topics about the similar issue, but there were no topics about file upload with CFv5+CCv5 joint use and it seems to me i'm deadlocked.
Please, help me if you can. I would really appreciate.
Hello mike9791,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Multiple file uploads from an iPad/iPhone don't work
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Multiple file uploads from an iPad/iPhone don't work
P.S: I'm just an automated service😉
Hi Mike,
Try to add a "custom code" action after the "file upload" and use this code:
And keep your current config as it is.
Regards,
Max
Try to add a "custom code" action after the "file upload" and use this code:
<?php
$form->data["Publication"]["fil"] = $form->data["fil"];
And keep your current config as it is.
Regards,
Max
Hi, Admin. Thanks for a quick response.
I did as you've said, but there were no effect. Then the form is returning to a conection list view of my publications i get "Saved successfully", but my DB field 'fil' is clear, and a file is not uploaded.
I added a Debbuger and then a Show stopper action just after File Upload action.
Here is a Debugger result for a new publication creation:
And here is one for an edited publication:
You see that the difference is only in [publ_id] (in the case with new publication it's predictably valueless).
But in both cases thereare no traces of my Publication[fil] field. It seems like it has not be processed at all.
I've changed my "Publication[fil]" name simly to "fil" and then debugged my form.
Here is a result:
Any suggestions?
I did as you've said, but there were no effect. Then the form is returning to a conection list view of my publications i get "Saved successfully", but my DB field 'fil' is clear, and a file is not uploaded.
I added a Debbuger and then a Show stopper action just after File Upload action.
Here is a Debugger result for a new publication creation:
Data Array
Array
(
[cont] => lists
[act] => edit
[ccname] => publicationeditor
[chronoform] => publication_edit
[event] => submit
[Itemid] => 511
[option] => com_chronoconnectivity5
[view] => connection
[task] => pseudocron
[a973cab6fd817a8abea1eacc149675f8] => 1
[Publication] => Array
(
[publication_title] => new_publication
[author_1] => new_author
[author_2] =>
[author_3] =>
[author_4] =>
[author_5] =>
[author_6] =>
[conf_id] => 43
[publ_id] =>
)
[button8] => Сохранить
)
Array
(
)
Errors
Array
(
)
And here is one for an edited publication:
Array
(
[cont] => lists
[ccname] => publicationeditor
[act] => edit
[gcb] => 21
[chronoform] => publication_edit
[event] => submit
[Itemid] => 511
[option] => com_chronoconnectivity5
[view] => connection
[Publication] => Array
(
[publication_title] => edited publication
[author_1] => edited author
[author_2] =>
[author_3] =>
[author_4] =>
[author_5] =>
[author_6] =>
[conf_id] => 38
[publ_id] => 21
)
[button8] => Сохранить
)
Array
(
)
Errors
Array
(
)
You see that the difference is only in [publ_id] (in the case with new publication it's predictably valueless).
But in both cases thereare no traces of my Publication[fil] field. It seems like it has not be processed at all.
I've changed my "Publication[fil]" name simly to "fil" and then debugged my form.
Here is a result:
Data Array
Array
(
[cont] => lists
[act] => edit
[ccname] => publicationeditor
[chronoform] => publication_edit
[event] => submit
[Itemid] => 511
[option] => com_chronoconnectivity5
[view] => connection
[Publication] => Array
(
[publication_title] => new_publication
[author_1] => new_author
[author_2] =>
[author_3] =>
[author_4] =>
[author_5] =>
[author_6] =>
[conf_id] => 38
[publ_id] =>
)
[button8] => Сохранить
[fil] => 20140310101631_ad_february.doc
)
Array
(
[fil] => Array
(
[name] => 20140310101631_ad_february.doc
[original_name] => ad_february.doc
[path] => /home/collegem/public_html/components/com_chronoforms5/chronoforms/uploads//20140310101631_ad_february.doc
[size] => 35840
[link] => /home/collegem/public_html/components/com_chronoforms5/chronoforms/uploads//20140310101631_ad_february.doc
)
)
Errors
Array
(
)
Debug Info
Array
(
[] => Array
(
[Files Upload] => Array
(
[0] => Upload routine started for file upload by : fil
[1] => /home/collegem/public_html/components/com_chronoforms5/chronoforms/uploads//20140310101631_ad_february.doc has been uploaded successfully.
)
)
)
Any suggestions?
Your file field name should be "fil", but not "Publication[fil]", did you try the code with that ?
Regards,
Max
Regards,
Max
This topic is locked and no more replies can be posted.