Question Retrieve client file content

hugo7

New member
Joined
Jun 19, 2011
Messages
3
Programming Experience
1-3
Hi all , i've got an win forms application which create an .txt file , and an web application online. I want to know if it's possible for the web application to retrieve the content of the .txt file created by the win forms app , to insert it after in a database.

Thanks

ps : sorry for english i'm french ;)
 

hugo7

New member
Joined
Jun 19, 2011
Messages
3
Programming Experience
1-3
answer

Thanks for the answer , so i have a problem ^^
I'v got this code on a webpage :
VB.NET:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        TextBox1.Visible = True
        Dim file As New System.IO.StringReader("C:\Documents and Settings\Travail(hugo)\Mes documents\test.txt")
        TextBox1.Text = file.ToString
    End Sub

Ad after online the value of the textbox is "System.IO.StringReader" or my .txt file named "test" contain this "test test code"

Thanks for the help
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
Try something like this (please be aware that test.txt needs to be located somewhere into the web app):


Dim MyTestFile As String = IO.Path.Combine(Server.MapPath("~", "test.txt")
        If IO.File.Exists(MyTestFile ) Then
   Dim sr As New StreamReader(MyTestFile )
   TextBox1.Text = sr.ReadToEnd()
   sr.Close()
   sr.Dispose()
        Else
 

hugo7

New member
Joined
Jun 19, 2011
Messages
3
Programming Experience
1-3
answer

Thanks for the answer but that's the problem my .txt file is not located somewhere into the web app , he's just in the client computer.
So i have to Upload the file into my web app from the client app first .
Need help for that , thanks
 
Top Bottom