I have been using the classic asp code for some time and it works perfect.
However, I like to translate it to asp.net vb. Nevertheless, I´m unsure to how to get it to work.
I know it not a direct Androd4basic question, but I believe this is the best forum.
The android code is unchanged:
Dim req AsHttpRequest
Dim size AsLong
size = File.size(File.DirRootExternal, fil)
InputStream1 = File.OpenInput(File.DirRootExternal, fil)
req.InitializePost("
http://XXXXXXXX/uploadform_lyd.aspx?hvad=" & hvad2 & "&tlf=" & tlf_id, InputStream1, size)
HttpClient1.Execute(req, 1)
The old classic asp code was:
a=Request.TotalBytes
if a >1 then
b=Request.BinaryRead(a)
set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = 1 '// binary data
BinaryStream.Open
BinaryStream.Write b
BinaryStream.SaveToFile hvor & strFileName, 2 '// save to disk
set BinaryStream = nothing
end if
my draft asp.net vb code:
Dim bytes AsInteger
bytes = Request.TotalBytes
If bytes > 1 Then
Dim byteData() AsByte
byteData = Request.BinaryRead(bytes)
Dim oFileStream As System.IO.FileStream
oFileStream = New System.IO.FileStream(hvor & strFileName, System.IO.FileMode.Create)
oFileStream.Write(byteData, 0, byteData.Length)
oFileStream.Close()
end if
I am not sure how to debug it, but my HttpClient1_ResponseError "Reason" returns: Internal Server Error
What am I doing wrong ?
Is there at better/easier way ?
Does anyone have a working example ?
Thanks in advance.
Kent