M Moosi Member Licensed User Longtime User Jul 22, 2017 #1 Hi all, I´m looking for a solution to download a large file (>50MB) with progress. But I need to send the Request as POST string. Does someone has an Idea how to do this? thanks in advance Moosi
Hi all, I´m looking for a solution to download a large file (>50MB) with progress. But I need to send the Request as POST string. Does someone has an Idea how to do this? thanks in advance Moosi
Erel B4X founder Staff member Licensed User Longtime User Jul 23, 2017 #2 See this example: https://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/ It should be simple to send a POST request instead of GET. Upvote 0
See this example: https://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/ It should be simple to send a POST request instead of GET.
M Moosi Member Licensed User Longtime User Jul 23, 2017 #3 Thanks a lot, it works. This is what I did, just in case someone looks for the same. In DonwnloadService I changed the DownloadData from: Code: Type DownloadData (url As String, Target As Object, EventName As String) to Code: Type DownloadData (url As String, Target As Object, EventName As String, PostString As String) So I added the PostString to the Type then I changed the Public Sub StartDownload(data As DownloadData) where I replaced the J.Download(data.url) with: Code: If data.PostString.Length > 0 Then J.PostString(data.url,data.PostString) Else J.Download(data.url) End If The call is now: Code: Dim dd As DownloadData dd.url = "MyURL" dd.EventName = "EventName" dd.Target = Me dd.PostString = "" <--- This is now needed CallSubDelayed2(DownloadService, "StartDownload", dd) That way I can pass an empty PostString to use the HTTP GET but when I pass a Value it uses the HTTP POST. One thing to note, you need to pass the empty value, otherwise it would be NULL and throw an error. Maybe it helps someone... Upvote 0
Thanks a lot, it works. This is what I did, just in case someone looks for the same. In DonwnloadService I changed the DownloadData from: Code: Type DownloadData (url As String, Target As Object, EventName As String) to Code: Type DownloadData (url As String, Target As Object, EventName As String, PostString As String) So I added the PostString to the Type then I changed the Public Sub StartDownload(data As DownloadData) where I replaced the J.Download(data.url) with: Code: If data.PostString.Length > 0 Then J.PostString(data.url,data.PostString) Else J.Download(data.url) End If The call is now: Code: Dim dd As DownloadData dd.url = "MyURL" dd.EventName = "EventName" dd.Target = Me dd.PostString = "" <--- This is now needed CallSubDelayed2(DownloadService, "StartDownload", dd) That way I can pass an empty PostString to use the HTTP GET but when I pass a Value it uses the HTTP POST. One thing to note, you need to pass the empty value, otherwise it would be NULL and throw an error. Maybe it helps someone...