greetings to all
I'm trying to use SFTP instead of FTP to send images to a server securely.
I can not find the way to do that I have reviewed even JSch library but whenever I try to install the program to see if it works tells me downgrade fails.
I would like to know if anyone would know how to connect to an SFTP server and send a file.
Here is the code I use for FTP I have done.
As it is evident intent is to prevent can be listening to port 21 and locate the user and password.
I would appreciate some small code example or orientation.
Thanks to all
I'm trying to use SFTP instead of FTP to send images to a server securely.
I can not find the way to do that I have reviewed even JSch library but whenever I try to install the program to see if it works tells me downgrade fails.
I would like to know if anyone would know how to connect to an SFTP server and send a file.
Here is the code I use for FTP I have done.
B4X:
FTP.Initialize("FTP","192.168.1.71",21,"user","pass")
dia=DateTime.GetDayOfMonth (DateTime.Now)
mes=DateTime.GetMonth(DateTime.Now)
año=DateTime.GetYear(DateTime.now)
hora=DateTime.GetHour(DateTime.now)
minutos=DateTime.GetMinute(DateTime.now)
segundos=DateTime.GetSecond(DateTime.now)
fecha=dia & mes & año & "_" & hora & minutos & segundos & ".jpg"
Dim filename As String = fecha
Dim dir As String = File.DirRootExternal
camEx.SavePictureToFile(Data, dir, filename)
camEx.StartPreview 'restart preview
'send a broadcast intent to the media scanner to force it to scan the saved file.
Dim Phone As Phone
Dim i As Intent
i.Initialize("android.intent.action.MEDIA_SCANNER_SCAN_FILE", "file://" & File.Combine(dir, filename))
Phone.SendBroadcastIntent(i)
ToastMessageShow("Imagen Grabada." & CRLF & "File size: " & File.Size(dir, filename), True)
FTP.UploadFile(File.DirRootExternal, fecha, False, "/Pacientes/" & "P" & Paciente & "/" & fecha)
As it is evident intent is to prevent can be listening to port 21 and locate the user and password.
I would appreciate some small code example or orientation.
Thanks to all