Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Problem with the path

$
0
0

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?


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>