File Uploading via AJAX using Rails Helpers
I’ve come across an interesting situation when trying to write the Desko filesystem plugin. The issue is that I want an AJAX call to upload a file to Desko. The problem is that Javascript shouldn’t be allowed to access the local filesystem for security purposes. Apparently there is a hack around it (meaning there is a security risk with Javascript still?). I was trying to get others’ fixes working. One of them uses RJS templates which required me to install a gem for it. RJS from what I can see is a template that uses Javascript(rjs) instead of Ruby(rhtml). There is a nice helper function with it that does the AJAX file upload workaround automagically and I wanted to use it. RJS is supposed to be integrated into Rails 1.1. Lucky for me, Rails 1.1 was released today. I’m excited to get home to try it out and see if it can do what I want.