嗨我想保存只使用fileupload文件的路径。在单击按钮时,我只想将用户选择到文件上载的完整路径存储到数据库中。仅用于测试目的,我在下面的代码中使用了标签,但最终我会将其连接到数据库。我只需要存储用户选择的路径而不是文件。文件上传路径需要
HTML
C#,我一直在努力,但没有工作
protected void Button1_Click(object sender, EventArgs e)
{
string g = FileUpload1.FileName;
string b =Convert.ToString(FileUpload1.PostedFile.InputStream);
//string filepath = Path.GetFullPath(FileUpload1.FileName.toString());
Label1.Text = g;
Label2.Text =b;
}
什么是不工作? – Izzy 2015-04-01 10:37:05
是否Path.GetDirectoryName(fileName);给你你需要什么? – Ulric 2015-04-01 10:37:15
它给我只有文件名。我需要这条路。 – Gerard 2015-04-01 10:53:34