title: Uploading picture to picasa web
body: <p>I m trying to upload a new photo to picasa using the API.
  code not working
  I am getting the following error:</p>
  
  <pre><code>Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.
  </code></pre>
  
  <p>My Code:</p>
  
  <pre><code>string imgPath = "C:\foo.png"; 
  StreamReader reader = new StreamReader(imgPath); 
  string imgBin = reader.ReadToEnd(); 
  reader.Close();
  string id=""//picasa ID
  string album = "";//album name
  string url = String.Format("http://www.picasaweb.google.com/data/feed/api/user/{0}/album/{1}",id, album);
  string auth = "";
  
          Byte[] send = Encoding.UTF8.GetBytes(imgBin); 
          int length = send.Length;
          HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
          req.Method = "POST";
          req.ContentType = "image/png";
          req.ContentLength = length;
          req.Headers.Add("Authorization", "GoogleLogin auth=" + auth);
          req.Headers.Add("Slug", "test");
          Stream stream = req.GetRequestStream();
          stream.Write(send, 0, length);
          stream.Close();
          WebResponse response = req.GetResponse();
          StreamReader reader = new StreamReader(response.GetResponseStream());
          string res = reader.ReadToEnd();
          reader.Close();
  </code></pre>
  
  <p>Thanks</p>