title: Upload images to sitecore media library from server
body: <p>How Can I upload images to Sitecore Media Library from a Folder on the server</p>
  
  <pre><code>var dir = new DirectoryInfo(MapPath("~/images/temp"));
  FileInfo[] files = dir.GetFiles();
  var list = new ArrayList();
  
  foreach (FileInfo file in files)
      {
          if (file.Extension == ".jpg" || file.Extension == ".jpeg" || file.Extension == ".gif" || file.Extension == ".png")
          {
              list.Add(file);
          }
      }
  
  // Now I want to add the files to media library in sitecore.
  </code></pre>