Jul 22, 2010

Asp.Net with C#



The c# code for Uploading Image using Upload files Controls to specific folder or location in your system or Server folder......




1.you have to add Upload file Control to your form.

2.Add another one submit button on same form.

3.then write following code onClick of Submit button.


Store an Image:

  string systemPath, serverPath, imageUpdate, imageId;
  string Image, ImageUpdate, Userid;
    systemPath = FileUpload1.PostedFile.FileName;
   serverPath =                              System.Web.HttpContext.Current.Server.MapPath("~/Images/");
         FileUpload1.PostedFile.SaveAs(serverPath +  System.IO.Path.GetFileName(systemPath));
         Image = serverPath + System.IO.Path.GetFileName(systemPath);



above program store your files into app_data/images folder

No comments:

Post a Comment