I have a web app that when a button is clicked it will read a text file on the users c drive and display the results of the text file.
StreamReader re = File.OpenText(@"c:\Datadetails\serverresults.bcp");
string input = null;
{
Label1.Text = (input);
}
I have used the above code and when the button is clicked it displays data from the servers c drive only. I need client side code that can read a file on the users local c drive and display it to the user,
The code below is a javascript function that is suppose to get the data client side but I cannot get this to work when a button is clicked. Does anyone know how I could place this in a button control to get this working.
Thanks for any help if anyone knows how to resolve this
function ReadFromFile() {
var strContent = ReadFileToString(document.Form1.TxtFileName.value);
document.Form1.HdnContent.value = strContent;
document.Form1.submit();
function ReadFileToString(strFileName) {
var strContents;
strContents =
objFSO =
strContents = objFSO.OpenTextFile(strFileName, 1).ReadAll();
I tried placing this in Page.ClientScript.RegisterStartupScript but could not work out the correct syntax.