I'm trying to do a bit of facebook integration with a website, and there's a particular call on the facebook api that post's a picture onto a users account. One of the parameters is the raw image data. The image is stored locally on the web server and I have a url to it. I was intending to load the image on the client using javascript until I learnt I couldn't do this. I'm currently trying an httpxml call to the server with the image url and intending for it to return the image data. This example code works with a url to a csv file, but it doesn't seem to want to read the image files contents. I'm getting an error when I try xmlhttp.responseText. The api call that I want to use this image data for is:
http://wiki.developers.facebook.com/index.php/Photos.upload
function getFile(pURL,pFunc) {
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
if (xmlhttp) {
eval('xmlhttp.onreadystatechange='+pFunc+';');
xmlhttp.open('GET', pURL, false);
xmlhttp.send();
}
}
function makeList() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
var tmpArr=xmlhttp.responseText;
document.getElementById('theExample').innerHTML=tmpArr;
}
}
}
Please excuse my terrible understanding of this webby stuff. I need to learn it, but I also need to do this quick bit of work before I can sit down and learn all this good stuff. I've been entrenched in a C#/C++ world for too long.