السلام عليكم
Dim ftpRequest As FtpWebRequest
Dim ftpResponse As FtpWebResponse
Try
'Settings required to establish a connection with the server
Me.ftpRequest = CType(FtpWebRequest.Create(New Uri("ftp://ServerIP/FileName")),FtpWebRequest)
Me.ftpRequest.Method = WebRequestMethods.Ftp.UploadFile
Me.ftpRequest.Proxy = Nothing
Me.ftpRequest.UseBinary = true
Me.ftpRequest.Credentials = New NetworkCredential("UserName", "Password")
'Selection of file to be uploaded
Dim ff As FileInfo = New FileInfo("File Local Path With File Name")
'e.g.: c:\\Test.txt
Dim fileContents() As Byte = New Byte((ff.Length) - 1) {}
Dim fr As FileStream = ff.OpenRead
fr.Read(fileContents, 0, Convert.ToInt32(ff.Length))
Dim writer As Stream = ftpRequest.GetRequestStream
writer.Write(fileContents, 0, fileContents.Length)
Me.ftpResponse = CType(Me.ftpRequest.GetResponse,FtpWebResponse)
'Gets the FtpWebResponse of the uploading operation
Response.Write(Me.ftpResponse.StatusDescription)
'Display response
Catch webex As WebException
Me.Message = webex.ToString
End Try
هذا الكود عن بععض المتغيرات not member ما بعرف ليش
ارجو المساعدة لاني بدي استخدمه لنقل الملفات لسيرفر somee