Forums

file uploads in ie6 *solved

Tom0 05 Apr, 2009
Well I spent so long finding where the problem was I thought I'd share. Chronoforms has a nice bit of JS to see if there is a file upload field and if so change the "enctype" of the form to allow it to send through files:

window.addEvent('domready', function() {
					if($chk($E('input[type=file]', $('<?php echo "ChronoContact_".$rows[0]->name; ?>')))){
						$('<?php echo "ChronoContact_".$rows[0]->name; ?>').setProperty('enctype', 'multipart/form-data');
					}
				});


However for some reason I could not get this to work in IE6 unless I wrote `enctype="multipart/form-data"` explicitly into the <form> tag (in cc.html.php), after a long long time trying to figure out why the JS worked in ff but not ie I found that when writing explicitly into the form tag the form property "encoding" gets set to "multipart/form-data" also. But it does NOT get set when using this code above. So I added a line into the above bit of script and now I have no problems:

window.addEvent('domready', function() {
					if($chk($E('input[type=file]', $('<?php echo "ChronoContact_".$rows[0]->name; ?>')))){
						$('<?php echo "ChronoContact_".$rows[0]->name; ?>').setProperty('enctype', 'multipart/form-data');
$('<?php echo "ChronoContact_".$rows[0]->name; ?>').setProperty('encoding', 'multipart/form-data');
					}
				});


please let me know if I have done something stupid!

Tom
Max_admin 07 Apr, 2009
Hi Tom,

Thank you for sharing this! in the last version, I made this as a PHP code because JS code is not guaranteed to work all time!😉

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tom0 07 Apr, 2009
haha one step ahead i see! Will have to check out what you have done although upgrading on my site is out of the question at this point!

Tom
This topic is locked and no more replies can be posted.