Skip to content

File Input Fields Not Supported #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zakcrawford opened this issue May 16, 2014 · 4 comments
Closed

File Input Fields Not Supported #374

zakcrawford opened this issue May 16, 2014 · 4 comments

Comments

@zakcrawford
Copy link

I ran into a situation where I wanted to be able to add data-remote="true" to a file input field. Turns out this doesn't work by default.

I made it work, here's a link to the gist: https://gist.github.com/zakcrawford/b05b1399208fcb257ff9

This will only work in browsers that support FormData();
(IE 10+, modern version of gecko and webkit)

Not sure if this is something that people are interested in, but if someone wants to create a way to do this that won't break in old browsers feel free to use my code as a starting point. The current test suite passed with my change, but I did not add any new tests.

@kevinhughes27
Copy link

I also ran into this issue and implemented a very similar fix. It would be nice to see it included. You are right about the old browsers issue I think this would need to be addressed before this would be included.

@zakcrawford
Copy link
Author

Unfortunately the only solution for old browsers is to create iFrames, there are existing solutions for rails 3.0+ but they're all pretty ugly.
I think that a graceful degradation solution could work.

@kevinhughes27
Copy link

I think you might be right. Would love to see this included.

@lucasmazza
Copy link
Contributor

I would leave this outside jquery-ujs until we drop support for IE 8/9 (and I honestly don't know which versions we should be supporting at the moment). Would be awesome if someone released the FormData support as some kind of plugin for jquery-ujs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants