(B4A 5.80)
Hi,
I'm trying to implement a file upload from my device to a Web API.
I've tried to do it as shown in many examples.
Hereafter my code:
On my .net side here is my controller's code:
My problem is: NOTHING in my WebGed .....
Any ideas ???
Thanks in advance.
Hi,
I'm trying to implement a file upload from my device to a Web API.
I've tried to do it as shown in many examples.
Hereafter my code:
B4X:
Dim out As OutputStream
out.InitializeToBytesArray(0)
Dim In As InputStream = File.OpenInput(File.DirInternal, "1.jpg")
File.Copy2(In, out)
Dim job1 As HttpJob
job1.Initialize("Photo", "Photo")
job1.PostBytes("http:....../File", out.ToBytesArray)
job1.GetRequest.SetHeader("Authorization",MyToken)
job1.GetRequest.SetContentType("application/json")
job1.GetRequest.Timeout = 60000
On my .net side here is my controller's code:
B4X:
<[POST]("file")>
<HttpPost()>
Public Function Send(<FromBody()> WebGed As Byte()) As Boolean
'code to store the file in data base
Return True
End Function
My problem is: NOTHING in my WebGed .....
Any ideas ???
Thanks in advance.