Android Question Upload PDF File

Calvin Yee

Member
Licensed User
Hi, I would like to use APP to upload pdf into file server via Internet.


But I don't have idea for this.


can u advide how to do it?
 

mangojack

Expert
Licensed User
Longtime User
Searching for FTP .... first result. (See Code snippet here first)



Snippet from one of my apps ... I have enabled FTP on server side and set ftp username & password (also created special folder)
Adjust for the file types.
Requires Net library....

B4X:
Public oFTP As FTP   'in my case Starter service Process Global

'Starter Service Create
'Initialise FTP  ...    called from sub Main - activity start and pause
Dim serverPath As String= "ftp.xxxxx.net"
Dim username As String= "xxxx123"
Dim password As String= "xxxxAbCd"
   
oFTP.Initialize("ftp", serverPath, 21, username, password)
oFTP.PassiveMode = True    'might not be neccessary

Public Sub UploadCurrentDB As ResumableSub   
    'upload the db  .. 3rd arg = False (non Ascii file)
    Dim sf As Object = oFTP.UploadFile(File.DirInternal,"appdata.db", False, "/app-files/xxxmyapp/data.db"  )
    Wait For (sf) ftp_UploadCompleted (ServerPath As String, Success As Boolean)

    If Success Then
        Log("file was uploaded successfully")
    Else
        Log("Error uploading file")
    End If
   
    Return Null       
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…