Brad, here is a snippet of VB code used to upload and download in VB:
This is the Download code:
Public FTPDownloadPath = “http://www.drivehq.com/file/df.aspx/publish/UserName/Scores/”
ServerPath = FTPDownloadPath & ScoreFile
Cursor.Current = Cursors.WaitCursor
Try
My.Computer.Network.DownloadFile(ServerPath, LocalFilePath, UserName, UserPassword, False, 100000, True)
Catch Ex As Exception
Exception = True
Status = "Scores for this week have not yet been uploaded to the server."
End Try
If Exception Then
Cursor.Current = Cursors.Default
MessageBox.Show(Status, "Scores Unavailable", MessageBoxButtons.OK, MessageBoxIcon.Information, _
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, False)
Exit Sub
End If
Cursor.Current = Cursors.Default
This is the Upload code:
Public FTPUploadPath As String = “ftp://ftp.drivehq.com/scores/”
ServerPath = FTPUploadPath & ScoreFileName
Try
My.Computer.Network.UploadFile(FilePath, ServerPath, UserName, UserPassword, True, 1000, True)
Catch Ex As Exception
Exception = True
Status = "Score upload failed - server may be unavailable."
End Try
If Exception Then
MessageBox.Show(Status, "Score Upload Failed", MessageBoxButtons.OK, MessageBoxIcon.Information, _
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, False)
Exit Sub
End If
MessageBox.Show("Score File for week " & ScoreWeek & " has been successfully uploaded.", _
"Scores Uploaded", MessageBoxButtons.OK, MessageBoxIcon.Information)
In my compilation of the program, I am the administrator and the only one that can upload files. The users can only download files.
Hope this helps, Jim