I’m trying to upload a video to facebook using the following code. The token and login are provided by a plugin. The overall url returns 400 bad request from facebook. The url is almost exactly what it would be if given from php. Am I doing something wrong in using www?
https://graph-video.facebook.com/me/videos?title=dogwalk&description=walkingthedog&access_token=BAABwFmwNiEIBAIGTyeitkr8SiA3CTUGFa46wFs8k87b1SC31Fi8loH4i8eZBoF561MAKJtwdIf8KVWbUYrroQirkFA7mjC1VAB7Ji6ujtphH81uZCPMqWaRpQWtvGoBiMwEseoGAPgMFqhwVhoTqTkrz56fPTK54t2FdN5X3kohTCZBqKL1odJ1H5Ip0bP8hAgvMdmRFvtc14UsnBIXr9CW9LPzjB7MxkQzOFyfiQZDZD
private WWW w;
public void FBPostVideo(){
var moviebytes = System.IO.File.ReadAllBytes(Application.persistentDataPath+"/screenrecording.mp4");
Debug.Log(moviebytes.Length);
WWWForm form = new WWWForm();
Hashtable myheaders = new Hashtable();
myheaders.Add("enctype","multipart/form-data");
var video_desc="walkingthedog";
var video_title="dogwalk";
var access_token=token;
form.AddBinaryData("file", moviebytes, "myvideo");
Debug.Log("the token="+token);
//var formurl="https://graph-video.facebook.com/";
var formurl = "https://graph-video.facebook.com/me/videos?"+ "title=" + video_title+"&description=" + video_desc + "&"+ token;
Debug.Log(formurl);
WWW w = new WWW(formurl,form.data,myheaders);
StartCoroutine(waitForMovie(w));
}
I tried to post an image using almost exactly the same code and it works fine.
– dansavHi. Thanks for taking a stab at it. I've tried it both ways since posting and it gives the same 400 bad request. I've also tried putting the token in the form and same result. I've also since successfully uploaded an image using almost the same code structure. So I'm stumped.
– dansav