我想将文件上传到我的 FTP 服务器,凭据的值是 userlabel passlabel 和 servlabel,这些都是凭据的相应标签。 Passlabel 和 userlabel 实际上是混合的。 pass 是用户,而 userlabel 是密码。我想实现一个prgressbar,但我不知道该怎么做有人请帮忙
到目前为止,这是我的代码。
Private Sub BW_DoWork(ByVal sender As System.Object,
ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BW.DoWork
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create(ServLabel.Text &
TextBox1.Text),
System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential(PassLabel.Text, UserLabel.Text)
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes(txtFile.Text)
' upload file...
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
BW.ReportProgress(clsStream.Position.ToString)
MsgBox("File Is Now In Database", MsgBoxStyle.OkOnly, "Upload Complete")
End Sub