system.io.fileinfo

Browse for file window without uploading the file

落花浮王杯 提交于 2019-12-24 08:22:10
问题 Is there a way to get the select file dialog box open and putting the location of the file into a textbox without ever uploading the file? ETA I'm using VB.NET in a web page. By using the asp:fileupload tag I can get the file location _fudFileLocation.PostedFile.FileName_ But how do I prevent the file from being uploaded at all. We don't need it, just the file location. (The files are on a shared drive so if it's M:\documents\todayslunch.pdf for person A, it's the same for person B.) 回答1: You

Converting file into Base64String and back again

♀尐吖头ヾ 提交于 2019-12-17 07:04:38
问题 The title says it all: I read in a tar.gz archive like so break the file into an array of bytes Convert those bytes into a Base64 string Convert that Base64 string back into an array of bytes Write those bytes back into a new tar.gz file I can confirm that both files are the same size (the below method returns true) but I can no longer extract the copy version. Am I missing something? Boolean MyMethod(){ using (StreamReader sr = new StreamReader("C:\...\file.tar.gz")) { String AsString = sr

DirectoryInfo.GetFiles method not returning any files

有些话、适合烂在心里 提交于 2019-12-08 12:03:57
问题 I'm trying to return the .config files that exist in %WINDIR%\System32\inetsrv\config . For this I am using the following code: DirectoryInfo configFolder = new DirectoryInfo(Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\System32\inetsrv\"); FileInfo[] configFiles = configFolder.GetFiles("*.config"); This returns zero objects into configFiles . If I use another folder (say D:\DropBox) is works fine! This code used to work, has something changed?? Also, FileInfo fi = new FileInfo

Searching By File Extensions VB.NET [duplicate]

我的未来我决定 提交于 2019-12-02 12:56:12
问题 This question already has answers here : What is a NullReferenceException, and how do I fix it? (31 answers) Closed 2 years ago . Hi all i have been trying to search a specified directory and all sub directories for all files that have the specified file extension. However the inbuilt command is useless as it errors up and dies if you dont have access to a directory. So here's what i have at the moment: Private Function dirSearch(ByVal path As String, Optional ByVal searchpattern As String =

Searching By File Extensions VB.NET [duplicate]

北城余情 提交于 2019-12-02 04:32:50
This question already has an answer here: What is a NullReferenceException, and how do I fix it? 31 answers Hi all i have been trying to search a specified directory and all sub directories for all files that have the specified file extension. However the inbuilt command is useless as it errors up and dies if you dont have access to a directory. So here's what i have at the moment: Private Function dirSearch(ByVal path As String, Optional ByVal searchpattern As String = ".exe") As String() Dim di As New DirectoryInfo(path) Dim fi As FileInfo Dim filelist() As String Dim i As Integer = 0 For