iOS Question FTP work fine first time

Discussion in 'iOS Questions' started by MarcoRome, Apr 29, 2018.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all, i have this code:

    Code:
    Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)

        
    If Success Then
            
            
            filenameresize = 
    "foto" & DateTime.Now
            
    Log(filenameresize)
            
            
            
    '******Save picture and trasfert via FTP
            Dim Out As OutputStream
            Out = 
    File.OpenOutput(File.DirTemp, filenameresize & ".jpeg"False)
            
    Image.WriteToStream(Out, 100"JPEG")
            Out.Close
            img_photo.Bitmap = 
    LoadBitmap(File.DirTemp,filenameresize & ".jpeg")
            
    'ftp was previously initialized And its event name was set To ftp:
            ftp.Initialize("FTP""ftp.xxxx.eu"21, usr_ftp, pw_ftp)
            
    ftp.PassiveMode = True
            
    ftp.UploadFile(File.DirTemp, filenameresize & ".jpeg"False"/" & filenameresize&".jpeg")
            
    Else
            
    Log("Non selezionato")       
    End If
    End Sub

    Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
        
    Log(ServerPath & ", Success=" & Success)
        
    If Success = False Then
            
    Log(LastException.Message)
        
    Else
            Toast.ShowToastMessage(
    "Foto copiata sul server ",2000)
        
    End If
    End Sub
    Work fine the first time, after if i select new file, the event FTP_UploadCompleted ISNT fired
    Any idea ?
    Thank you
    Marco
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Initialize FTP once when the program starts.
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    Hi Erel, already do but dont change nothing
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Hard to say. Try to close it after each transfer and then initialize it again.

    If it doesn't work then you can send me a small project and I'll try it here.
     
    MarcoRome likes this.
  5. chardenal

    chardenal Member Licensed User

    Hello,

    I have exactly the same problem, works fine the first time but nothing after for the second file to upload...
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice