I've picked up a project after a long time (I really dont have time for programming but b4a keeps pulling me back)
I am trying to detect the upload progress but I am not entirely sure how.
This is where the request goes out:
So I have an input stream opened from a file, and redirected to the output stream which will be posted using File.Copy2
Since File.Copy2 copies all the data immediately (I think!), am I probably better monitoring the output stream as it is posted?
Unfortunately I can do neither and the count always return 0.
I am trying to detect the upload progress but I am not entirely sure how.
This is where the request goes out:
B4X:
Dim in As InputStream
in = File.OpenInput(Dir, FileName)
UploadLength = in.BytesAvailable
PostInputStream.Initialize(in)
Log("PostStreamCount:" & PostInputStream.Count)
File.Copy2(in, stream) 'read the file and write it to the stream
Log("PostStreamCount:" & PostInputStream.Count)
b = EOL.GetBytes("UTF8")
stream.WriteBytes(b, 0, b.Length)
b = (EOL & "--" & boundary & "--" & EOL).GetBytes("UTF8")
stream.WriteBytes(b, 0, b.Length)
b = stream.ToBytesArray
UpdateFileTransfers(0)
'PostInputStream.Initialize(stream)
tmrProgress.Enabled = True
Dim req As HttpRequest
req.InitializePost2(link, b)
req.SetContentType("multipart/form-data; boundary=" & boundary)
req.SetContentEncoding("UTF8")
req.SetHeader("Authorization", authHeader)
Return req
So I have an input stream opened from a file, and redirected to the output stream which will be posted using File.Copy2
Since File.Copy2 copies all the data immediately (I think!), am I probably better monitoring the output stream as it is posted?
Unfortunately I can do neither and the count always return 0.