Hi all,
If got myself a bit stuck. I'm writing an application that reads a header dump in the form of a text file. I've got it working and can select the location of the text file by getting the user to manually input the directory into a textbox however, i want to make it a bit more friendly. I've been trying to use methods of the 'fileupload' class to make use of the browse ability. unfortunaly it will only read in file that are placed in the 'Microsoft Visual Studio 9.0\Common7\IDE\' directory.
Here's what if got when reading in the file.....
/*---Check valid file has been selected---*/
if (FileUpload1.HasFile)
{
/*--- No error if file presesnt ---*/
load_feedback.Text = " ";
/*--- Get the full path of file on computer ---*/
string strFileNameWithPath = FileUpload1.PostedFile.FileName;
/*--- Get the extension name of the file ---*/
string strExtensionName = System.IO.Path.GetExtension(strFileNameWithPath);
/*---Read text from file into string---*/
using (StreamReader rdr = File.OpenText(strFileNameWithPath))
{
string input_from_file = rdr.ReadToEnd();
input_from_file = input_from_file.Trim(); //trim white spaces from start and end
.
.
.
/*--- Close the stream ---*/
rdr.Close();
}
Any help appreciated :)