Home > Articles > Home & Office Computing

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend


As mentioned earlier, uploading photos is a little different from downloading, because it doesn't quite fit into the model created by the rest of the API. Here, your code—or in this case the Flickr.NET API's code—must manually create an HTTP POST event and provide the image file(s), and then handle the success or failure response, which will be in REST format. This isn't too complicated to code by hand, but is very simple using any of the API implementations.

The primary function of this demo app is downloading, but just to show how we've included the ability to upload a single file as well. This is much easier than downloading, as you won't have to trouble yourself with any Streams:

private void btnUpload_Click(object sender, System.EventArgs e)
  OpenFileDialog dialog = new OpenFileDialog();

  dialog.CheckFileExists = true;
  dialog.Multiselect = false;

  if(dialog.ShowDialog(this) == DialogResult.OK)
  {  flickr.UploadPicture(dialog.FileName); }

Other overridden upload methods provide the ability for add a title, set access levels, and specify other metadata about the photo itself.

  • + Share This
  • 🔖 Save To Your Account