Hi,
Here is my File upload event.
protected void UploadButton_Click(object sender, EventArgs e)
{
if (FileUploadControl.HasFile)
{
try
{
string filename = Path.GetFileName(FileUploadControl.FileName);
tb_ph_file.Text = Path.GetFullPath(FileUploadControl.PostedFile.FileName);
lb_ph_file2.Text = filename;
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
FileUploadControl.SaveAs(@"C:\inetpub\VS2012\" + filename);
aspImagePreview.Visible = true;
aspImagePreview.ImageUrl = "~/" + filename;
lb_msg2.Text = "Upload status: File uploaded!";
}
catch (Exception ex)
{
...
}
}
}
but when uploading the file on the page, I see that the value of "tb_ph_file.Text" is actually
c:\windows\system32\inetsrv\t346.png
Why?
↧
Problem with the path
↧