file uploads with iframe and IE 6/7
Yesterday, macsim’work on #mootools asked some questions regarding IE and file uploads.
He tried to send a form with an attachment to an iframe, and it worked without problems in any non-IE browser (Opera, Firefox, Safari, Chrome).
And while file uploads today is no brain science, this error/bug was new to me, and something I’d never run into before.
We sat down and had a thorough look at the issue.. And with some help from ie developer toolbar and google we found a solution.
While it works without a problem to upload files using enctype=”multipart/form-data” in most browsers:
<form action="#" enctype="multipart/form-data" method="post"> <input name="myFile" type="file" /> </form>
IE 6/7 also needed the encoding set in this case.. So we added encoding=”multipart/form-data” to the form:
<form action="#" enctype="multipart/form-data" encoding="multipart/form-data" method="post"> <input name="myFile" type="file" /> </form>
So, lesson learned:
“If a form fails to send file fields as files in IE, with enctype of multipart/form-data, try setting encoding to multipart/form-data as well”
macsim’work’s blogpost in english (for the not so french savvy, thanks to google translate)
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.



[...] gives the solution in english Vote 3.00 sur 5 [?] [Translate] English ??????? ????????? català ?esky [...]