I use a plugin to load jQuery files along with rails 3. The plugin is here:
https://github.com/blueimp/jQuery-File-Upload
I use a plugin to allow the user to upload a profile photo. The solution so far works with Chrome, Safari and Firefox. However, on IE this fails. When you select a file in IE, plugins are sent to the server, but there are no parameters, this is an empty post.
Example message in chrome:
Started PUT "/api/1/settings/ajax_photo_upload" for 10.0.1.3 at 2012-10-02 15:39:20 -0700 Processing by ApiV1::SettingsController#ajax_photo_upload as JS Parameters: {"photo"=>#<ActionDispatch::Http::UploadedFile:0x007f9e4bac2e48 @original_filename="xxxxx.jpeg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"user[photo]\"; filename=\"xxxxx.jpeg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/3x/k1yb0r4s07q1jm82kq93ch180000gn/T/RackMultipart20121002-3633-sxsbtu>>}, "update_type"=>"general"}
However, in IE9 it does not send anything:
Started PUT "/api/1/settings/ajax_photo_upload" for 10.0.1.10 at 2012-10-02 15:39:31 -0700 Processing by ApiV1::SettingsController
Here is my implementation:
$('input[type="file"]').fileupload({ url : '/api/1/settings/ajax_photo_upload', formData : [{ name : 'authenticity_token', value : $('meta[name="csrf-token"]').attr('content') }], type : 'PUT', dataType: 'json', add : function (e, data) { data.submit(); } });
HTML
<input name="user[photo]" type="file" accept="image/*" >
Any ideas why IE will do this? Thanks