Get the status of PutFile

Advertisement

abellos
Joined:
Posts:
2

Get the status of PutFile

Hello,
first time that use the library. I have a cycle to upload file on an SFTP server.
This is my code
If Session.Opened Then
 
    Try
        CONN.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & PercorsoDB)
        SQL = "SELECT percorso, nomefile, est FROM gestioneIMG WHERE Invio >= 44866 and Invio <= 44870"
 
        RS.Open(SQL, CONN, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
 
        ' Upload files
        Dim transferOptions As New TransferOptions
        transferOptions.TransferMode = TransferMode.Binary
 
        While Not RS.EOF
            nomePdf = RS("nomefile").Value.ToString & "." & RS("est").Value.ToString
            Percorsopdf = RS("percorso").Value.ToString & nomePdf
 
            PercorsoRemoto = "/test/08439/upload_scansioni/F01/ORIGINAL/"
 
            If Not Session.FileExists(PercorsoRemoto) Then
                Session.CreateDirectory(PercorsoRemoto)
            End If
 
            StreamFile = File.OpenRead(Percorsopdf)
            Session.PutFile(StreamFile, PercorsoRemoto & nomePdf, transferOptions)
 
            txt.Text = txt.Text & vbCrLf & "caricamento" & nomePdf
 
            RS.MoveNext()
        End While
 
 
        RS.Close()
        RS = Nothing
 
        CONN.Close()
        CONN = Nothing
 
        MsgBox("File caricati")
    Catch exc As Exception
 
        MsgBox("Errore" & exc.Message)
    End Try
Else
    MsgBox("session chiusa")
End If
How can I know if the file is uploaded correctly? With PutFiles there is the TransferOperationResult class, for single file there is some similar?
Thanks

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum