Hello
We have a form where you have to upload four individual images, but sometimes it shows the same image four times instead of four images. Some users have reported this.
This is correct example:
Image 1
20130320093912_Firefox.jpg
Image 2
20130320093912_Screen Shot 2013-03-19 at 3.38.34 PM.png
Image 3
20130320093912_418971_285171051555919_875316114_n.jpg
Image 4
20130320093912_logo-mob.png
This is an error sample:
Image 1
20130319223741_image.jpg
Image 2
20130319223741_image.jpg
Image 3
20130319223741_image.jpg
Image 4
20130319223741_image.jpg
Any ideas what could be causing this?
Hi weiseren,
I've not seen this before. If you can recreate the problem please drag a Debugger action into the On Submit event, then submit the form and post the results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
I finally found the error.
Its when using an ipad to submit the form with images.
See debug attached.
BR
Kasper
Hi Kasper,
Well found. I don't' know much about the workings of iPads but it looks as though in the $_FILES array all four of the images have the same name: image.jpg This might explain why the problem occurs.
Without going to dig in the code my guess is that ChronoForms uses the value of the name parameter to rename the files and as it is the same in each case the later files over-write the earlier ones.
Bob
Hello Bob,
It was 4 different images I tried to upload with the iPad so it must take image as the same filename.
I have ensure that all name attributes are different.
Would there be some fix which could ensure it writes different filenames - or is this a software/device issue with the iPad?
BR
Kasper
Hi Kasper,
I suspect that it is an 'iPad feature' - but I know nothing about their inner workings or how to debug them :-(
It should be possible to add a check in a Custom Code action to change the file names if they are the same. I'll see if I can put something together.
Bob
Yes - I also just tested - if you send an email with a photo attachment, then no matter the image, it will always use the same filename when sending single files.
BR
Kasper
I am using chronoforms for j1.5 - so I have some issues still, might be doing something simple wrong...
In the form management form code tab > On Submit code - before sending email, i pasted the code, but does not do anything.
Please see my attached screenshots - I am not sure which combinations should be used.
BR
Kasper
Hi Kasper,
Sorry, I hadn't noticed that you were using ChronoForms v3. The code would be similar. I'll they and check in the morning, not sure if I still have a test site with CFv3 on it.
Bob
AH ok thanks a lot!
Happy to see that it was an issue that might help others too! Great.
Hi Kasper,
It looks as though this isn't going to work with ChronoForms v3 :-( The code I wrote still works correctly but the On Submit Before Email box is run after the File Upload is complete so it had no effect.
I'm afraid that I don't have any other suggestions: it's either hack the ChronoForms core code or upgrade to CFv4.
Bob
How will my old forms cope with the upgrade to V4?
kw
Hi Kasper,
Possibly with difficulty as there is no automatic upgrade :-( I generally advise deferring it until you are ready to go to Joomla! 2.5-3.0
There's a FAQ with some more information.
Bob