I've got the Facebook Graph API working via Classic ASP, and I understand how to do most things like posting a status update, getting user info and so forth. I'm stuck on trying to upload photos from our company's photo gallery to our page on Facebook.
The steps that have to开发者_如何学运维 happen are:
- Read the photo file from the server's file system
- POST the file via the Facebook Graph API, getting the posted photo's ID
- Add tags to the photo using the photo's ID retrieved in the previous step
- Move on to the next photo
If anyone can offer advice on what form the photo file data should be in (would I use an ADODB.Stream
, or convert the binary to text, or some other method?) and how I must format the POST to get it up to Facebook, I'd hugely appreciate it.
Take a look at the api docs for uploading How-To: Use the Graph API to Upload Photos to a user’s profile If you look at Scenario 1: Uploading a photo to the app’s album towards the bottom you can see the sample in php. Below is the code converted for you. If you are talking about an app where you are actually hosting the page shown on facebook, then you will need a com object like http://www.aspupload.com/ to handle the upload.
<%
access_token=your_access_token
theURL="https://graph.facebook.com/me/albums?access_token="&access_token
%>
<form enctype="multipart/form-data" action="<%=theURL%>"method="POST">
<input name="source" type="file">
<BR>
<input name="message" type="text" value="">
<input type="submit" value="Upload" />
</form>
精彩评论