Hi,
Is there a way to write the following pure javascript in prototypejs
var xhr = new XMLHttpRequest();
xhr.open("POST", "/photos?authenticity_token=" + token
+ "&photo[name]=" + img.name
+ "&photo[size]=" + img.size);
xhr.overrideMimeType('text/plain; charset=x-user-defined-binary');
xhr.sendAsBinary(bin);
I did this but I don't know how to upload the bin
file
var url = '/photos';
new Ajax.Request(url, {
method: 'post',
parameters: {
authenticity_token: token,
'photo[name]': img.name,
'photo[size]': img.size
},
onSuccess: function(transport) {
alert('Yeah');
}
});
thanks