Android Question FTP Upload problem

Discussion in 'Android Questions' started by barryhuntpinncomp, Feb 7, 2015.

  1. barryhuntpinncomp

    barryhuntpinncomp Member Licensed User

    I am trying to FTP a single web page up to my web site. It has worked some months ago.I have tried the Net library and FTP Auto both with the same result.

    I have tried two different web spaces of mine with the same result.

    The error message I get, after a long time, is:
    Error uploading file.
    425 Could not open data connection to port 38071: Connection timed out
    (The port number changes with each try)

    I use a numerical IP address or URL and each yield the same result. The user and password I am using in the real code is correct as I can use other FTP software to administer and access my web sites.

    The file is in the correct directory but with zero bytes. I have tried to upload different files all with the same result.

    I have tried 2 android phones and one tablet, also both wi-fi and mobile data connection all with the same result.

    Any help you could give me would be much appreciated.

    Here is the code:

    Sub Process_Globals
    Dim L As String
    Dim wifion As Boolean
    Dim Writer As TextWriter
    End Sub

    Sub Globals
    Dim FTP As FTP_Auto
    Dim myLAN As ServerSocket
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
    FTP.Initialize(Activity, Me,"[IP or FTP URL]", "user","pass", 21,True, False)
    End If
    l = "Line1"
    l = l & "Line2"
    l = l & "Line3"
    l = l & "Line4"
    Writer.Initialize(File.OpenOutput( File.DirRootExternal , "test.html",False))
    Writer.WriteLine(l )
    Writer.Close
    CheckForWiFi
    If wifion=True Then
    FTP.UpLoadFile( File.DirrootExternal ,"public_html", "test.html")
    End If
    End Sub

    Sub CheckForWiFi()
    If myLAN.GetMyIP <> "127.0.0.1" Then
    Log( myLAN.GetMyIP)
    ToastMessageShow ("Internet connected OK", True)
    wifion=True
    Return
    End If
    ToastMessageShow ("No Internet connection", True)
    wifion = False
    End Sub​
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    I'm not familiar with FTP Auto. Not sure why you need it. FTP from the Net library is pretty simple to use.

    Try to set FTP.PassiveMode to true.
     
  3. barryhuntpinncomp

    barryhuntpinncomp Member Licensed User

    Thank you, Erel, that was the fix.

    I tried Net first and when I could not make it work I tried FTP Auto.

    I had not seen FTP.PassiveMode,

    Thank you very much.
     
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