Forums

multipage with file action and file rename

saveg 11 Dec, 2019
Im having a terrible time getting this to work properly
Pls see attched image as it explain all action in sequence
I have a page to load the form
then p2 is for showing the form data entered on prev page
then submit.
the main problem is that file is uploaded with rename rule and it works, but in db and email it shows the old file name value.
I have tried many options but still now luck can someone pls comment on this?
healyhatman 11 Dec, 2019
{data:fileupload} will be the name as originally uploaded. You want {var:file_upload_action_name.file_field_name.filename} and also that custom code is useless .
saveg 12 Dec, 2019
thanks
1. ignore the custom code. I will remove it
2. shall I put {var:file_upload_action_name.file_field_name.filename} in the db save action override??? what I want so basically rename any file to
Personal_Pic_USERID_USERNAME.EXT
personal_pic is fixed in all filename then userid then username then ext where shall I add {var:file_upload_action_name.file_field_name.filename} and I think you meant
{var:file_upload_action_name.file_field_name.fileext} not {var:file_upload_action_name.file_field_name.filename} right
healyhatman 12 Dec, 2019
1. Good
2. No, you would put {var:upload6.personal_pic.filename} in the save action.

Have a look at your debug it will show you the data available to you.
saveg 12 Dec, 2019
thanks for the update
actually do you meant by:
2. No, you would put {var:upload6.personal_pic.filename} in the save action.
is to create a separate save action or the same db save action, Im not really getting it quite right here, can you pls explain?
saveg 12 Dec, 2019
thx
here is a screenshot of what I changed to and had no effect on the db value and kept inserting the old filename into db
​[file=12488]Screenshot_2019-12-13_My_Joomla_test_site_-_Administration.png[/file]
healyhatman 13 Dec, 2019
What does it have in the debug? Drag a debug action at the END of the actions, or just tick the debug option
saveg 13 Dec, 2019
thx
actually I shifted the action from p4 to submit page (which is the last resort) and I dont prefer doing so.
the reason is that on p4 user finishes the form filling and uploads files then he see a confirmation page. due to db not saving name correctly and putting old name in db and the file is actually uploaded with the new name, this will create a mess between the file uploaded and the file name in db.
so what I ended up doing is showing the user the vlaues of form on p4 and below that he has the upload button then he submits and gets another screen of confirmation and the db is updated with correct name.
I couldnt get the db save overrride to work on filename. Im out of ideas to be honest can you suggest any fix?

below if the value of array on submit

Array
(
    [submit_validate_fields] => Array
        (
            [log] => Automatic validation enabled.
            [var] => 1
        )

    [upload6] => Array
        (
            [path] => /home/XXXXXX/public_html/XXXXX/components/com_chronoforms6/chronoforms/uploads/
            [personal_pic] => Array
                (
                    [extensions] => Array
                        (
                            [0] => jpg
                            [1] => jpeg
                            [2] => png
                            [3] => gif
                            [4] => pdf
                        )

                    [saved] => 1
                )

            [var] => Array
                (
                    [personal_pic] => Array
                        (
                            [path] => /home/XXXXX/public_html/XXXXX/components/com_chronoforms6/chronoforms/uploads/Personal_Pic_363_admin.jpg
                            [filename] => Personal_Pic_363_admin.jpg
                            [name] => graphicstock-man-on-sofa-watching-tv-with-apple_SdI63NP3e_SB_PM.jpg
                            [size] => 127533
                        )

                )

        )

    [save_data3] => Array
        (
            [data] => Array
                (
                    [created] => 2019-12-13 12:47:53
                    [user_id] => 363
                    [personal_pic] => Personal_Pic_363_admin.jpg
                    [name_en] => 
                    [surname_en] => 
                    [name_ar] => 
                    [surname_ar] => 
                    [appseason] => Jan2020
                    [dob] => 30/12/2019
                    [gender] => Male
                    [marital_status] => Married
                    [mobile1] => 0999999999
                    [mobile2] => 08888888
                    [email1] => admin@XXXX
                    [email2] => 11@22.com
                    [username] => admin
                    [facebookpageurl] => http://www.fb.com
                    [otherpageurl] => http://www.tw.com
                    [didyouwork] => 
                    [county] => Ba
                    [city] => 
                    [area] => 
                    [text47] => 
                    [streetname] => 
                    [houseno] => 
                    [nearestpoi] => 
                    [ip_address] => 88.XX.XX.XX
                    [dateofapp] => 2019-12-13 12:46:20
                    [currentdegree] => BSc
                    [currentgraduni] => Bag
                    [currentgradfaculty] => Law
                    [currentgraddept] => 
                    [currentgradyr] => 2019
                    [currentgpa] => 00.99
                    [ref1name] => 
                    [ref1job] => 
                    [ref1contactno] => 
                    [ref2name] => 
                    [ref2job] => 
                    [ref2contactno] => 
                    [countrytoapply] => 
                    [placeofappointment] => Tu
                    [applytodegree] => 
                    [q1_1] => 
                    [q1_2] => 
                    [q1_3] => 
                    [q1_4] => 
                    [q1_5] => 
                    [q2_1] => 
                    [q2_2] => 
                    [q2_3] => 
                    [q2_4] => 
                    [q3_1] => 
                    [q3_2] => 
                    [q3_3] => 
                    [q4_1] => 
                    [q5_1] => 
                    [q5_2] => 
                    [q6_1] => 
                    [q7_1] => 
                    [q8_1] => 
                    [q9_1] => 
                    [q10_1] => 
                    [passport_file] => 
                    [iraqi_national_id_face] => 
                    [iraqi_national_id_back] => 
                    [grad_cert_en] => 
                    [grad_cert_official] => 
                    [recommendation_letter] => 
                    [essay_letter] => 
                    [cv_ar] => 
                    [cv_en] => 
                    [residence_card] => 
                    [proof_of_address] => 
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => INSERT INTO `jos43_chronoforms_data_XXXX` (`created`, `user_id`, `personal_pic`, `name_en`, `surname_en`, `name_ar`, `surname_ar`, `appseason`, `dob`, `gender`, `marital_status`, `mobile1`, `mobile2`, `email1`, `email2`, `username`, `facebookpageurl`, `otherpageurl`, `didyouwork`, `county`, `city`, `area`, `text47`, `streetname`, `houseno`, `nearestpoi`, `ip_address`, `dateofapp`, `currentdegree`, `currentgraduni`, `currentgradfaculty`, `currentgraddept`, `currentgradyr`, `currentgpa`, `ref1name`, `ref1job`, `ref1contactno`, `ref2name`, `ref2job`, `ref2contactno`, `countrytoapply`, `placeofappointment`, `applytodegree`, `q1_1`, `q1_2`, `q1_3`, `q1_4`, `q1_5`, `q2_1`, `q2_2`, `q2_3`, `q2_4`, `q3_1`, `q3_2`, `q3_3`, `q4_1`, `q5_1`, `q5_2`, `q6_1`, `q7_1`, `q8_1`, `q9_1`, `q10_1`, `passport_file`, `iraqi_national_id_face`, `iraqi_national_id_back`, `grad_cert_en`, `grad_cert_official`, `recommendation_letter`, `essay_letter`, `cv_ar`, `cv_en`, `residence_card`, `proof_of_address`)  values  ('2019-12-13 12:47:53', '363', 'Personal_Pic_363_admin.jpg', '', '', '', '', 'Jan2020', '30/12/2019', 'Male', 'Married', '0999999999', '08888888', 'admin@XXX', '11@22.com', 'admin', 'http://www.fb.com', 'http://www.tw.com', '', 'Bag', '', '', '', '', '', '', '88.247.x.x', '2019-12-13 12:46:20', 'BSc', 'Bag', 'Law', '', '2019', '00.99', '', '', '', '', '', '', '', 'Tur', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                )
saveg 13 Dec, 2019
This is driving me crazy
now I have done the following
p1
p2
p3
p4(file upload page)
p5 (review all data before submit) & (file upload action only) and it works well and rename is done correct and array value is correct.
submit page (db save action and email sent) the file name value is now being saved to the old name is saved to the db despite earlier it was correct.
the screen below
saveg 13 Dec, 2019
Here is my analysis
for some reason the data override isnt working on the field personal_pic in the db despite im sure the name is correct in db
attached is a basic test I did just now on override and actually the logs does not show any insertion
im bit confused
if the override works then thats all what I want.
but Im still puzzled on why its not?
saveg 13 Dec, 2019
Here is my conclusion on this issue
on multipage form if I do file rename and db save if that new filename it has to consecutive actions one after the other and it has to be on the same page, I couldnt find a way to separate them between two pages.
The logic of this is that
you reach file upload page then you upload (here you insert file upload and rename action) and proceed to review the form data (here you show user the form data he sent along with the renamed file values) and then you submit (this is where I need to insert db save and email) . but I couldnt replicate this into reality via chronoforms.
Would someone pls help here???
saveg 14 Dec, 2019
just a quick update, because of multipage, the file variables on the same page are correct but when I use db save action on the next page it shows incorrect value. is there a way to preserve the variable values throughout the form?
GreyHead 14 Dec, 2019
Hi saveg,

You can save them to the Joomla User Session and reload them on the next page - or my preference is to save each page to the database table with a 'provisional' status and then carry the record id forward either in a hidden input or in the User Session.

Bob
saveg 14 Dec, 2019
Thanks for the info.
I went ahead and in the action list I cant see any save session action at all.
below is a screen of what I have in action.
could you pls explain it more clearly how I can do this???
preferably step by step?
saveg 16 Dec, 2019
Can someone pls help here??
Im sure there is a way, but I need more clear directions pls
GreyHead 17 Dec, 2019
Hi saveg,

I'm sorry, Max seems to have removed the Sessions actions from the current release (though they are still shown in the manual). If there is a replacement action I don't know what that is - you can use Custom PHP to write values to the User Session.

Bob
healyhatman 17 Dec, 2019
Logic -> Data Builder 2 is how you save things to session now.

Or you can use Custom Code (not PHP) and do {session:name$value} to set the value and {session:name} to retrieve it
Or you can do it in PHP with.... whatever the Joomla session getters/setter are.
saveg 17 Dec, 2019
Data builder 2 seems a good option but I cant understand the logic of how do I save session and read it again. can you pls give me some hint or example?
saveg 20 Dec, 2019
Thanks Im note sure if we are on the same page.
Ive inserted data builder 2 action
pls see the screenshot below
not sure where to put {session:name} though???
saveg 20 Dec, 2019
Ive added the custom code and I can see them in next session when I show up the message {session:nameofsession} but strange enough that
[save_datalog] => Array
and
 [_success] => Data saved successfully
            [log] => Array
both saves old value in the debug screen. shall I worry about this?
healyhatman 21 Dec, 2019
What have you put in your data builder?
saveg 24 Dec, 2019
Ive sorted this out but doing another data builder action to save again the prev page session data, not sure if its meant like this but it worked at last. Thanks alot for this
This topic is locked and no more replies can be posted.