Buy Now
Sign in

how to preserve file upload filename and path from local client if upload action fails

saveg , January 07 2020, 10:53
S
saveg 90
January 07 2020, 10:53 #390568
Im having 16 file upload fields in a multipage form and Im doing a size and ext check after submit button and checking is server side.
the problem Im having is that the if filefield1 fails a faill msg is shown (as Im doing action redirect when failure) but all filefield2 / filefield3 / filefield4 ..... loses the file selected. is there a way a just keep the value for the file selected on those file fields.
healyhatman 8
January 07 2020, 10:58 #390569
Don't use a redirect use an event loader. You can also use a switcher area for each field with {var.empty:fileuploadactionname} with the "true" event showing the field (because if it's empty, no file was uploaded and you need to show the field. If it's false, a file WAS uploaded and you don't need to upload again.)
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
S
saveg 90
January 07 2020, 13:25 #390573
yes well spot on.
Actually I was using event loader.
Can I use the action name inside the fieldswitcher even before calling??
Im still not getting the idea can you pls explain it more?
S
saveg 90
January 07 2020, 13:29 #390574
Here is what Im doing, shall I insert file field inside 0 and 1 or how?
action name is upload6 upload7
FFiled.png
Attachments
FFiled.png
FFiled.png
(47.63 KiB)
81 Downloads/Views
S
saveg 90
January 07 2020, 13:45 #390576
could you pls confirm that the path is preserved using switcher area????
S
saveg 90
January 07 2020, 16:54 #390581
What I really need is to preserve the file paths and file name when the fail is triggered so that all file selected for upload are kept intact unless user click on browse and select another file.
any idea?
GreyHead 64
January 08 2020, 12:35 #390588
Hi saveg,
Personally I would keep it simple and upload the files from each page when that page is submitted and I would save the data to a 'provisional' database record at the same time. When the next page is submitted upload the files from that page and update the database record. On final submission validate the data and change the status of the record from 'provisional' to 'confirmed'. To keep things tidy you can also run a cron job every so often to look for 'provisional' records more than say 24 hours old and delete the corresponding files and the record.
You don't normally have access to the path of the files on the users computer - though I guess it might be possible to grab it using JavaScript.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
saveg 90
January 08 2020, 15:59 #390593
thanks for clarification but would the below statement apply and fix the file paths and selected file?
Don't use a redirect use an event loader. You can also use a switcher
area for each field with {var.empty:fileuploadactionname} with the
"true" event showing the field (because if it's empty, no file was
uploaded and you need to show the field. If it's false, a file WAS
uploaded and you don't need to upload again.)
S
saveg 90
January 08 2020, 16:01 #390594
I meant would you the switcher area fix this problem?? and if yes Im can someone explain the logic clearly?
S
saveg 90
January 08 2020, 16:27 #390595
ive done {var.empty:upload6} and its working fine and not showing in the next event loader.
it did the trick and well done for the idea, but if the user again makes wrong file type upload for the next submit. the file field acually shows again. how can I prevent it from re showing once it successful ie never show once the file is accepted no matter the number of submit ?
dont forget we have 16 files to upload and user is dumb enough to make wrong types and sizes. we want to fully control it?
S
saveg 90
January 09 2020, 17:14 #390621
anyone there???
can I use double switcher area to overcome this problem??? is it nested switcher area or how can I overcome this problem
healyhatman 8
January 09 2020, 19:09 #390625
Costs you nothing to try. Could also store in session with data builder 2 that the file was uploaded and use {session.empty:namegoeshere}
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
S
saveg 90
January 09 2020, 19:51 #390634
thanks for clarification. actually I did do {session.empty:actionnamehere} and seems to be working. just wondering will this eat up memory on the server as I will endup doing 19 sessions created and saved
healyhatman 8
January 09 2020, 20:05 #390637
Unless you have billions of concurrent users I doubt it's going to matter.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store