Photos.Upload not returning anything (despite successful upload)?

Jun 9, 2010 at 3:18 PM
Edited Jun 9, 2010 at 3:22 PM
I have some code for uploading photos to a users default album which works, the photo is uploaded successfully. However, the return value is just "Facebook.Schema.photos_upload_response".

The code in question is:

var returnvalue = Master.Api.Photos.Upload("albumid", "caption", file , uid);
Response.Write(returnvalue);

I am expecting some xml return from facebook which I can process and use but all I get is "Facebook.Schema.photos_upload_response", which is obviously useless..

Any ideas?
Jun 9, 2010 at 5:29 PM
Ugh, ignore this, I fixed. And I'm also an idiot :)
Jun 9, 2010 at 9:06 PM
Can you share what did you find??? =D
Jun 10, 2010 at 3:39 PM
Edited Jun 10, 2010 at 3:40 PM
I was being an idiot and couldn't work out how to return the photoID of the new photo. Of course I was forgetting to simple reference the returnvalue as an object. If anyone is interested, here's my code.

   protected void btnSubmit_Click()
    {
        int contentlength = fileUploadid.PostedFile.ContentLength;
        string uploadtype = fileUploadid.PostedFile.ContentType;

        // fb accepts *GIF *JPG *PNG *PSD *TIFF *JP2 *IFF *WBMP *XBM

        if (contentlength != 0 && (uploadtype == "image/bmp" || uploadtype == "image/jpeg" || uploadtype == "image/gif" || uploadtype == "image/png" || uploadtype == "image/tiff" || uploadtype == "image/psd" || uploadtype == "image/photoshop"))
        {
            string path = Directory.GetCurrentDirectory();
            byte[] bData = new byte[fileUploadid.PostedFile.ContentLength];

            fileUploadid.PostedFile.InputStream.Read(bData, 0, fileUploadid.PostedFile.ContentLength);

            //Write file
            WriteToFile("<path>" + fileUploadid.PostedFile.FileName, ref bData);
            // create file info object
            System.IO.FileInfo oInfo = new System.IO.FileInfo("<path>" + fileUploadid.PostedFile.FileName);

            // do upload to facebook, returns photo object with useful properties

            var returnvalue = Master.Api.Photos.Upload("", flatsharename_textbox.Text, oInfo, userid);

            photoid = returnvalue.pid;

        }


         private void WriteToFile(string strPath, ref byte[] Buffer)
    {
        // Create a file

        FileStream newFile = new FileStream(strPath, FileMode.Create);

        // Write data to the file

        newFile.Write(Buffer, 0, Buffer.Length);

        // Close file

        newFile.Close();
    }

}