0

I have a FileUpload control and I am trying to upload an image to server with it but it fails. My view:

<asp:FileUpload ID="FileUploadImage" runat="server" />

And my c#:

try
{
    HttpPostedFile yuklenecekDosya = FileUploadImage.PostedFile;
    if (yuklenecekDosya != null)
    {
        FileInfo dosyaBilgisi = new FileInfo(yuklenecekDosya.FileName);
        string yuklemeYeri = 
            Server.MapPath("~/Images/NewUrunler/" + dosyaBilgisi);
        FileUploadImage.SaveAs(Path.Combine(yuklemeYeri));
    }
}
//some code for catch

It does not give any error but also it doesn't upload image. I spend hours on it and only thing I get is 'yuklenecekDosya' come as null when I debug it. Why is it null ?

diiN__________
  • 7,393
  • 6
  • 42
  • 69

0 Answers0