0

I am trying to upload picture to ftp. I can connect using filezilla or explorer. But when I use vb.net code I get error: System.Net.WebException: The remote server returned an error: (500) Syntax error, command unrecognized. Please help. I am going mad. Code I am using:

Public Sub upload2ftp(ByVal _FileName As String, ByVal _UploadPath As String, ByVal _FTPUser As String, ByVal _FTPPass As String) Try Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(_UploadPath), System.Net.FtpWebRequest) request.Credentials = New System.Net.NetworkCredential(_FTPUser, _FTPPass) request.Method = System.Net.WebRequestMethods.Ftp.UploadFile request.UsePassive = False request.KeepAlive = False Dim file() As Byte = System.IO.File.ReadAllBytes(_FileName) Dim strz As System.IO.Stream = request.GetRequestStream() strz.Write(file, 0, file.Length) strz.Close() strz.Dispose() Catch ex As Exception MsgBox(ex.ToString) End Try

user1164545
  • 129
  • 3
  • 5
  • 10

1 Answers1

0

Problem was Kaspersky. Turned it off and upload went good.

user1164545
  • 129
  • 3
  • 5
  • 10