string saveDir = @"UpLoads"; string appPath = Request.PhysicalApplicationPath; if (FileUpload1.HasFile) { string savePath = appPath + saveDir; FileUpload1.SaveAs(savePath); UploadStatusLabel.Visible = false; //lblErrorMsg.Text = "Your file was uploaded successfully."; return true; } else { // Notify the user that a file was not uploaded.. UploadStatusLabel.Visible = true; UploadStatusLabel.Text = "Specify a file."; return false; }
if (!Directory.Exists("yourPath")){ Directory.CreateDirectory("yourPath"); }
string TempPath = "UploadPatientImage\\TempImage"; DirectoryInfo thisFolder = new DirectoryInfo(TempPath); if (!thisFolder.Exists) { thisFolder.Create(); } FileUpload1.PostedFile.SaveAs(TempPath + "\\" + FileUpload1.FileName);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)