我想将图像存储在我项目的根文件夹中。但是图像存储在管理文件夹->图像中。这是我的C# 代码:此代码写在管理面板 -> AddProducts 文件中。
protected void Button3_Click(object sender, EventArgs e)
{
FileUpload FileUpload1 = FileImage;
string virtualFolder = "images/";
string img = "images/";
string f = (DateTime.Now.GetHashCode()).ToString(); ;
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + f + FileUpload1.FileName);
Image1.Visible = true;
Image1.ImageUrl = virtualFolder + f + FileUpload1.FileName;
string path = img + f + FileUpload1.FileName;
TextBox4.Text = path;
}