I am trying to fix a program that another developer has developed. What I'm trying to fix is everytime the program attempts to upload a file it would return a 'File . not found (code=550)'. The weird thing is that the actual file for some reason would actually upload... When I received a copy of the code to fix I tried the program out myself and it gives me the same error yet the file actually doesn't upload.
The code Imports Utilities.FTP (Which I haven't been able to find a lot of documentation on online..) and the exception is thrown after the ftp.CopyToFTP() is run. CopyToFTP basically copies the file to the FTP site directory you place.
Does anyone have any way to trouble shoot this? or a solution?
Private Sub FtpOutputFile(ByVal atts As List(Of String)) Dim inStream As StreamReader Dim parseLn() As String Dim ftp As New Utilities.FTP.FTP()
Try
inStream = New StreamReader(File.OpenRead(Me.Directory & "ftp.dat"))
'Setup FTP object
While inStream.EndOfStream = False
parseLn = Split(inStream.ReadLine(), ",")
Select Case parseLn(0)
Case "Destination"
ftp.Destination = parseLn(1)
Case "Expiration"
ftp.Expiration = parseLn(1)
Case "Host"
ftp.FTP_Host = parseLn(1)
Case "Password"
ftp.FTP_Password = parseLn(1)
Case "Timeout"
ftp.FTP_Timeout = parseLn(1)
Case "UserName"
ftp.FTP_UserName = parseLn(1)
End Select
End While
inStream.Close()
Dim MyEnum As IEnumerator(Of String) = atts.GetEnumerator
While MyEnum.MoveNext 'I added this? Before it was just the directory but this would be the entire file?
ftp.Source = Path.GetDirectoryName(MyEnum.Current) + "\DailyExcel" & DailyDate.ToString("yyyyMMdd") & ".csv"
If Not ftp.CopyToFTP() Then
Throw New Exception(ftp.ErrorMessage)
End If
End While
Catch ex As Exception
Trace.WriteLine(Date.Now.ToString("MM/dd/yyyy HH:mm") & ": " & ex.Message & vbNewLine & ex.StackTrace)
MsgBox(ex.Message())
End Try
End Sub
my .dat file is as follows:
Destination,excelfiles/Test/
Expiration,30
Host,myftp.mydomainname.com
Password,password
Timeout,5000
UserName,username