This repository has been archived by the owner. It is now read-only.

Changing xhr to send FormData object #2

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

iterion commented Aug 7, 2012

Instantiate the FormData object with rails csrf then append the file to that object.

In my limited testing it works with the documentation outlined in the readme, yet without the dependency on rack_raw_upload dependency.

Changing xhr to send FormData object
Instantiate the FormData object with rails csrf
then append the file to that object.
Contributor

jsteiner commented Aug 7, 2012

I cleaned this up a little, and made the file param key configurable here: https://github.com/thoughtbot/jack_up/tree/use_form_data

iterion commented Aug 7, 2012

Sweet, looks great. You could set the file param to 'model[column]' and rails won't be able to tell the difference between this and a regular form submission.

It might also be nice to instantiate jack_up on a form itself, so it could automatically assign handlers as well as the path and file param.

FYI, in rails 3.2.8, the csrf_token couldn't be validated and would sign my user's out.
I had to use @jsteiner 's use_form_data branch... thanks for the great gem!

@iterion iterion closed this Nov 12, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.