Sub SendtoSever(dir As String, pk As String, FileName As String,pt As String)
If File.Exists(dir,FileName) Then
' continue
Else
ToastMessageShow(" Sorry - Zip Not Found: "&FileName, False)
Log(" Sorry - Zip Not Found: "&FileName)
Return
End If
Dim j As HttpJob
Dim out As OutputStream
out.InitializeToBytesArray(0)
Dim In As InputStream = File.OpenInput(dir, FileName)
' Log(" send to server file: "&FileName)
File.Copy2(In, out)
Dim lastSlash As Int = FileName.LastIndexOf("/")
If lastSlash > -1 Then
FileName = FileName.SubString(lastSlash + 1)
End If
Dim su As StringUtils
Dim j As HttpJob
j.Initialize("file", Me)
If pk = 1 Then 'campics
j.PostBytes( Main.srvlinkcam & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt, out.ToBytesArray)
End If
If pk = 2 Then ' inspect pdfs
j.PostBytes( Main.srvlinkins & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt, out.ToBytesArray)
End If
If pk = 3 Then ' ecmdata files zips
j.PostBytes( Main.srvlinkecm & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt, out.ToBytesArray)
' ToastMessageShow("Sending Zip File to Server: "&FileName,False)
End If
End Sub