1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Public Function GetFileSize(ByVal FileName As String) As Integer
Dim iFileSize As Integer = 0
Dim FTPreq As System.Net.FtpWebRequest
FTPreq = Net.FtpWebRequest.Create(New Uri(Me._Uri & FileName))
FTPreq.Credentials = New Net.NetworkCredential(Me._User, Me._pass)
FTPreq.Proxy = Nothing
FTPreq.KeepAlive = False
FTPreq.Method = Net.WebRequestMethods.Ftp.GetFileSize
Dim Response As Net.FtpWebResponse
Response = FTPreq.GetResponse()
MessageBox.Show(Response.ContentLength)
iFileSize = Response.ContentLength
Return iFileSize
End Function |
Partager