B4J Question File Upload with Websocket - show progress?

JanPRO

Well-Known Member
Licensed User
Longtime User

JanPRO

Well-Known Member
Licensed User
Longtime User
I have found a simple solution:

1.) Add this code in your Webscoket_Connected sub:
B4X:
    ws.Eval($"
        $('#id').ajaxForm({
            uploadProgress: function(event, position, total, percentComplete) {
                b4j_raiseEvent("upload_progress",{"progress":percentComplete});
            }
        });"$,Null)
2.) Set the id of your form
3.) Get the progress:
B4X:
Sub upload_progress(Params As Map)
    Dim Progress As Float = Params.Get("progress")
    Log(Progress)
End Sub


Jan
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…