title: AjaxFileUpload saves images to local directory instead of server directory
body: <p>It keeps saving images to local directory or not at all.
  It doesn't give me any error.
  As far as i know there is no relationship between my local drive and the host. All my pages are at the host and they are working fine. But I imported bin directory files( AjaxControlToolkit.dll,Site.dll,site.pdb) from my localhost to web server before creating this page.</p>
  
  <p>Source file:</p>
  
  <pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderIcerik" runat="server"&gt;
    &lt;asp:ToolkitScriptManager runat="server"&gt;&lt;/asp:ToolkitScriptManager&gt;
  
    &lt;asp:AjaxFileUpload ID="AjaxFileUploadResimEkle" runat="server"  
      AllowedFileTypes="jpg,jpeg" 
      onuploadcomplete="AjaxFileUploadResimEkle_UploadComplete" /&gt;
  &lt;/asp:Content
  </code></pre>
  
  <p>></p>
  
  <p>CodeBehind:</p>
  
  <pre><code>    protected void AjaxFileUploadResimEkle_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
          {
            int PostID = Convert.ToInt32(Request.QueryString["PostID"]);
            var makale = (from p in db.Posts
                          where p.PostID == PostID
                          select new { p.PostID, p.Title }).Single();
  
            string uzanti = Path.GetExtension(e.FileName);
            if (e.ContentType.Contains("image"))
            {
              if (e.FileSize &lt;41943040)
              {
                Guid benzersiz = Guid.NewGuid();
  
                string filePath =string.Format("~/images/blog/large_image/{0}_{1}{2}", makale.Title, benzersiz,uzanti);
  
                AjaxFileUploadResimEkle.SaveAs(Server.MapPath(filePath));
  
                System.Drawing.Image degisecekResim = System.Drawing.Image.FromFile(filePath));
  
                Bitmap kucukResim = ResimKucult(degisecekResim);
                string kucukResimYolu = string.Format("~/images/blog/medium_image/{0}_{1}{2}", makale.Title, benzersiz,uzanti);
                kucukResim.Save(Server.MapPath(kucukResimYolu));
  
                Resimler resim = new Resimler();
  
                resim.PostID = PostID;
                resim.FileName = filePath;
                resim.SmallFileName = kucukResimYolu;
                resim.IsActive = true;
                db.Resimlers.AddObject(resim);
                db.SaveChanges();
  
              }
            }
          }
  
      Bitmap ResimKucult(System.Drawing.Image resim)
      {
        int x = 225;
        int y = 165;
  
        Bitmap bmpOrji = new Bitmap(resim);
        if (bmpOrji.Width &gt; bmpOrji.Height)
        {
          y = bmpOrji.Height * x / bmpOrji.Width;
        }
        else if (bmpOrji.Height &gt; bmpOrji.Width)
        {
          x = bmpOrji.Width * y / bmpOrji.Height;
        }
  
        Bitmap yeniBmp = new Bitmap(bmpOrji, x, y);
  
        return yeniBmp;
      }
  
    }
  </code></pre>