palehorse
Active member
- Joined
- Jan 28, 2005
- Messages
- 34
- Programming Experience
- 1-3
Hello All,
I have this program
Actually, I have the idea of it. I am very new to programming and I was hoping somebody could help me out here...
What I need it to do is, when a User is selected - the program goes to a certain directory on their machine according to the user selected and gets all the files in that directory and then sends them up to a server - and then moves all of those files that it sent, into another "backup" type folder on the users machine.
My question is this: How to get the program to Upload all the files in a selected directory, to a predefined server?
All your help is always appreciated
My Application:
[/font]
My ASPX File:
I have this program
Actually, I have the idea of it. I am very new to programming and I was hoping somebody could help me out here...
What I need it to do is, when a User is selected - the program goes to a certain directory on their machine according to the user selected and gets all the files in that directory and then sends them up to a server - and then moves all of those files that it sent, into another "backup" type folder on the users machine.
My question is this: How to get the program to Upload all the files in a selected directory, to a predefined server?
All your help is always appreciated
My Application:
VB.NET:
[font=Lucida Console][color=#0000ff]Dim[/color] filePath [color=blue]As String[/color] = "c:\program files\user\xmit\"
[color=blue]Dim[/color] fileName [color=blue]As String[/color] = filePath & "text1.txt"
[color=blue]Dim[/color] myWebClient [color=blue]As[/color] [color=blue]New[/color] WebClient
[color=blue]Dim[/color] myStream [color=blue]As[/color] Stream = myWebClient.OpenRead(fileName)
[color=blue]Dim[/color] myStringWebResource [color=blue]As String[/color]
[color=blue]Dim[/color] strUploadPath [color=blue]As String[/color]
Try
myStringWebResource = "http://172.31.194.12"
strUploadPath = myStringWebResource & "/UploadFile.aspx"
myWebClient.UploadFile(strUploadPath, "POST", fileName)
txtStatus.Text = "Successfully Uploaded files " + myStringWebResource
Catch ex [color=blue]As[/color] Exception
txtStatus.Text = "Error Occured" + ControlChars.Cr
txtStatus.Text = txtStatus.Text + ex.Source + ControlChars.Cr
txtStatus.Text = txtStatus.Text + ex.Message + ControlChars.Cr
[color=blue]End[/color] Try[/font]
[font=Lucida Console]
My ASPX File:
VB.NET:
[/font]
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO"%>
<%@ Import Namespace="System.Net"%>
<%@ Import NameSpace="System.Web"%>
<Script language="VB" runat=server>
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim f As String
Dim file
For Each f In Request.Files.AllKeys
file = Request.Files(f)
file.SaveAs("c:\inetpub\wwwroot\" file.FileName)
Next f
End Sub
</Script>
<html>
<body>
<p> Upload complete. </p>
</body>
</html>