Sub Button2_Click
fl = EditText1.text & ".pdf"
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://www.mysito.it/myfolder/" & fl)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
If File.Exists(File.DirDocuments, "mypdf.pdf") Then
File.Delete(File.DirDocuments, "mypdf.pdf")
End If
Dim out As OutputStream
out = File.OpenOutput(File.DirDocuments, "mypdf.pdf",False)
File.Copy2(J.GetInputStream,out)
out.close
hd.ToastMessageShow("downloaded file",True)
remove
Else
hd.ToastMessageShow("file not found",True)
End If
j.Release
End Sub
Sub remove
fl = EditText1.text & ".pdf"
ftp.Initialize("ftp", "ftp.mysito.it", 21, "addresses", "password")
Dim sf As Object = ftp.DeleteFile("mysito.it/myfolder/" & fl)
Wait For (sf) ftp_DeleteCompleted(ServerPath As String, Success As Boolean)
If Success Then
hd.ToastMessageShow ("deleted file",True)
Else
Label1.Text= LastException.Message
End If
'ftp.Close
End Sub