English 中文(简体)
只从文件上载控制中找到文件途径
原标题:Capture only the file path from the file upload control
  • 时间:2011-10-31 13:08:38
  •  标签:
  • vb.net

I am trying to update some local access databases from a web database. When I am accessing the web page, I want the user to select a folder on the local hard drive where the DB s reside that will be updated by the program. I actually have been using the File Upload control to do this as it has allowed me to check the file extensions on the local DB s their file size and other misc. items.

这抓住了档案名称的全部道路......

fileName = FileUploadAccess.PostedFile.FileName.ToLower

Now I have a need to capture the full path of the db s on the local hard drive. I can get the full path with the filename, but then I need to write a bunch of code to strip the filename from the path variable.

Is there a simple way to capture the path of the location the DB when the file location is selected, something like this....

Dim thePath As String = System.IO.Path.GetFullPath

感谢任何建议。

最佳回答

您可使用IO.Path.GetDirectoryName

Here is a sample code:

Dim MyDirectoryPath As String = System.IO.Path.GetDirectoryName(MyFullPath)
问题回答

暂无回答




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签