I'm trying to upload a picture take with the camera, to a FTP.
In my routine, after the picture is taken, it checks the ftp directory to see if the file exists. If it does the user is asked if they want to replace it. If they answer yes, the picture is upload and replaces the existing picture. If the user answers no, it should not upload picture.
In my code below, The picture gets uploaded no matter how the user answers.
What am I doing wrong?
Thanks, John
In my routine, after the picture is taken, it checks the ftp directory to see if the file exists. If it does the user is asked if they want to replace it. If they answer yes, the picture is upload and replaces the existing picture. If the user answers no, it should not upload picture.
In my code below, The picture gets uploaded no matter how the user answers.
What am I doing wrong?
B4X:
Sub Start_Upload
MyPath = File.DirRootExternal & sRoot & "/" & sJobNo & "/" & sReportType & "/" & sCustID
MyFTPPath = "Inspections/" & sJobNo & "/" & sReportType & "/" & sCustID
MyUploadFile = sDefItem & ".jpg"
If (FTP.FileOrFolderExist(MyUploadFile, MyFTPPath, False)) = False Then
FTP.MakeDir("Inspections")
FTP.MakeDir("Inspections/" & sJobNo)
FTP.MakeDir("Inspections/" & sJobNo & "/" & sReportType)
FTP.MakeDir("Inspections/" & sJobNo & "/" & sReportType & "/" & sCustID)
FTP.UploadFile(MyPath, MyFTPPath, MyUploadFile)
End If
End Sub
Sub FTP_FileExist(Found As Boolean)
Dim Answ As Int
If Found Then
Answ = Msgbox2("Item " & sDefItem & " already excists. Do you want to replace it?","File Excists","Yes","","No", Null)
If (Answ = DialogResponse.POSITIVE) Then
FTP.UploadFile(MyPath, MyFTPPath, MyUploadFile)
End If
If (Answ = DialogResponse.NEGATIVE) Then
FTP.Close
End If
End If
End Sub
Thanks, John