Well, I imagine I am missing something obvious. I got it partially working, the problem is on the server side about half the time it writes a file that can't be read (.JPG) and the other half it writes about 1/3 of the file correctly and then writes - I'm not sure what. It is not random but it is not the picture either.
This is my Client side:
	
	
	
	
	
	
	
	
	
		        Dim m As Map
    Dim CMD As String = "DirExists"
    Dim CMD As String = "FileExists"
    'Client side file
    Dim Fdir As String = "D:\SkData\SK_Images"
    Dim FN As String = "02-321282-00.JPG"
    'Server side file
    Dim WriteToDir As String = "C:\AndroidApps\B4X\SKDBServer\SKDBServer-WriteFilesBeta"
    Dim WriteToFN As String = "Test.JPG"
    Dim H As HttpJob
    H.Initialize("H", Me)
    Dim m As Map
    m.Initialize
    m.Put("filename", WriteToFN)
    m.Put("filepath", WriteToDir)
    m.Put("fileBytes", File.ReadBytes(Fdir, FN))
    Dim su As B4XSerializator
    Dim data() As Byte = su.ConvertObjectToBytes(m)
    h.PostBytes($"http://${IPAddre.Text}:${PortNum}/writefile"$, data)
	 
	
	
		
	
 
And this is the server side:
	
	
	
	
	
	
	
	
	
		Sub Class_Globals
    Dim su As B4XSerializator
End Sub
Public Sub Initialize
   
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
    Dim in As InputStream = req.InputStream
    Dim buffer(req.ContentLength) As Byte
    in.ReadBytes(buffer, 0, buffer.length)
    Dim M As Map = su.ConvertBytesToObject(buffer)
    If File.Exists(M.Get("filepath"), M.Get("filename")) Then
        File.Delete(M.Get("filepath"), M.Get("filename"))
    End If
    File.WriteBytes(M.Get("filepath"), M.Get("filename"), M.Get("fileBytes"))
End Sub
	 
	
	
		
	
 
I know the data is correct when it goes because I converted it back to a map on the client side and wrote the file and it worked fine:
	
	
	
	
	
	
	
	
	
		'        m = su.ConvertBytesToObject(data)
'        File.WriteBytes(Fdir, $"000000Test2.jpg"$, m.Get("fileBytes"))
	 
	
	
		
	
 
My test file is only about 23k and the interesting thing is it contains the correct number bytes in M.Get("fileBytes"), it just doesn't write it correctly.
I have included  the correct file and the test file below (when it isn't corrupt). The test file displays differently here - when I open it the brown pattern is all the way down, there is no white as there is here.
As always, thanks for any help.