Friday, July 21st, 2006p>Raphael Bauduin has written about his experience converting a Rails remote form into a dojo.io.bind call that enables him to upload a file:
File uploads are finally deployed! You can now specify in MyOwnDB that a detail of your entity is of the type â€œfileâ€. This will let you attach a file to an entry, and subsequently replace or delete it. This required some changes in the application, more specifically in the way the forms are submitted back to the server.
How does it work?
Dojo transparently creates an IFRAME, and submits the form through that IFRAME. That way, the browser itself is submitting the file. This has the side effect that you loose some functionality compared to XMLHttpRequests, like illustrated by the last remarks above.
Iâ€™m really happy with the result and the simplicity of the code. It allowed me to not touch any code outside of the form submission, and treat all form in the same way. When I started coding this, Dojo was the only solution I found, but Yahoo!â€™s YUI lib has gained the same functionality with its connection manager, taking the same approach of creating an IFRAME.
Posted by Dion Almaer at 9:05 am