Android Question Server-Client-how can I get the real name of the file?

XorAndOr

Active Member
Licensed User
Longtime User
hello, the server works fine, it receives the files. Only the names are not the real names of the file.

B4X:
018-05-15 11:20:37.838:INFO::main: Logging initialized @378ms to 
2018-05-15 11:20:38.689:INFO:oejs.Server:main: Started @1232ms
Server started
Received file: image%3A8321.png, size=11801
Received file: image%3A8320.png, size=10691
Received file: image%3A8319.png, size=9574
Received file: image%3A8322.png, size=9826
Received file: image%3A8316.png, size=35600

B4X:
Sub Button1_Click
    cc.Initialize("CC")
    cc.Show("image/*","Choose image")
End Sub

Sub cc_Result (Success As Boolean, Dir As String, FileName As String)   

    If Success = True Then
        
        Dim out As OutputStream
        out.InitializeToBytesArray(0)
        Dim In As InputStream = File.OpenInput(Dir, FileName)
        File.Copy2(In, out)
    
        Dim lastSlash As Int = FileName.LastIndexOf("/")
        If lastSlash > -1 Then
            FileName = FileName.SubString(lastSlash + 1)
        End If
        Dim su As StringUtils
        Dim j As HttpJob
        j.Initialize("file", Me)
        j.PostBytes(link & "?type=file&name=" & su.EncodeUrl(FileName & ".png", "UTF8"), out.ToBytesArray)

        Log(FileName)                       
        
                
    End If
    
    
End Sub

I tried the solution of the link below

https://www.b4x.com/android/forum/t...s-returned-from-contentchooser.39313/#content

but the names are always with image% 3A8316 ... etc ... I'm missing something?

thanks
 

OliverA

Expert
Licensed User
Longtime User
You are URL encoding the filename on the client side. Are you URL decoding the filename on the server side?
 
Upvote 0
Top