I'm using the jQuery file uploader plugin along with rails 3. Plugin here:
https://github.com/blueimp/jQuery-File-Upload
I'm using the plugin to allow a user to upload a profile photo. The solution so far works with Chrome, Safari and Firefox. However on IE it fails. When you select a file in IE, the plugin posts to the server but there are no params, it's an empty post.
Example post 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 doesn't send over 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#ajax_photo_upload as JS
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 would be doing this? Thanks