When using iNMSSH-SFTP Upload files, how do I know the file name and path? Thanks
Dim remote As String = "/remote.dat"
ssh.UploadFile(File.DirAssets, "1.bil", remote)
Wait For ssh_UploadCompleted (success As Boolean)
Log("upload: " & success)
Log("Uploaded file is: " & remote)
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private cam As Camera
Private sftp1 As NMSSH
End Sub
Private Sub Application_Start (Nav As NavigationController)
'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("main")
NavControl.ShowPage(Page1)
sftp1.Initialize("sftp1")
End Sub
Sub InitCamera
cam.Initialize("cam", Page1)
End Sub
Sub btnOpenFile_Click
InitCamera
cam.SelectFromPhotoLibrary(Sender, cam.TYPE_IMAGE)
End Sub
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
If Success Then
If Image.IsInitialized Then
'File name ?????
'File path ?????
sftp1.UploadFile(File path, File name, "/File name")
Wait For sftp1_UploadCompleted (success As Boolean)
End If
End If
End Sub
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
If Success Then
If Image.IsInitialized Then
Dim folder As String = File.DirDocuments
Dim filename As String = "myFile.jpg"
saveAndUploadFile(Image,folder,filename)
End If
End If
End Sub
Sub saveAndUploadFile(bmp As Bitmap,folder As String, fileName As String)
'first we need to save the file
Dim Out As OutputStream
Out = File.OpenOutput(folder,fileName, False)
bmp.WriteToStream(Out, 100, "JPEG")
Out.Close
'now we can upload it
sftp1.UploadFile(folder, fileName, "/File name")
Wait For sftp1_UploadCompleted (Success As Boolean)
'...
End Sub