• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

How Do You Use the Tag <asp:FileUpload /> to go to the Direct Path to Retrieve the File?

I am trying to load a file using the ASP.NET tag <asp:FileUpload ID="BulkDataFileUpload" runat="server" />.  However, it is not retrieving the full path of the file name I am selecting.  It is only retrieving the file name.  I have to hard code the path to the file name.

My usage:
Dim file As String = "C:\BulkUploadFiles\" + BulkDataFileUpload.FileName

How do you use this tag without hard coding the file path?

Thanks,

Dan
0
danielolorenz
Asked:
danielolorenz
2 Solutions
 
Chinmay PatelEnterprise ArchitectCommented:
This is a server side tag and it will only get you the filename. What exactly you want to do with complete path? you want to check on server side from which folder user uploaded the file?

Or you just want to save the file? If you want to save the file then you can either hard code the path as you have done OR you can use Server.MapPath("~/Files/") + BulkDataFileUpload.FileName.
0
 
käµfm³d 👽Commented:
Only non-standardized browsers (e.g. early versions of IE) will provide you with the full path of a file on a client's machine. It is generally perceived as a security risk to divulge the full path of where a folder resides on a client's machine.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now