SQLExpress - Xb2.NET     ot4xb  
xb2net
POST with data in body
Thread Starter: Jack Duijf Started: 4/9/2008 2:25 PM UTC
Replies: 1
POST with data in body
Hello,

Until now i do a post using xbForm(). The post is to a ASP server Now the size of the parameter "filecontents" exeeds some limitations. I receive server error 500.
Is there a way to put the "filecontents" into the body of the post ?

Regards,
Jack Duijf


LOCAL oForm             := xbForm():new()

oRequest             := xbHTTPRequest():new(::oSock)
oResponse            := xbHTTPResponse():new(::oSock)
::cLastReply            := ""
// now we need to format the HTTP request
oRequest:Command        := "POST"
oRequest:HTTPVersion    := "1.0"
oRequest:KeepAlive(TRUE)
oRequest:Host(::cHost + ":" + NTrim(::nPort))

oRequest:Path(cPath)
//
// Invullen HTTP post parameters voor VB
//
oForm:SetVar("u"              ,::cUser) oForm:SetVar("p"              ,::cPaswd)
oForm:SetVar("actie"          ,::cActie)
oForm:SetVar("filecontents"   ,cData)
oRequest:Content := oForm if !(oRequest:send() == SOCKET_ERROR)
   if !oResponse:Recv()
       ...
   endif
endif
Re: POST with data in body
"Jack Duijf" <jack@aicn.nl> wrote in news:16f138a2$3edf229e$cc84
@news.xbwin.com:

Until now i do a post using xbForm(). The post is to a ASP server Now the size of the parameter "filecontents" exeeds some limitations. I receive server error 500.
Is there a way to put the "filecontents" into the body of the post ?

See sample UploadFile:  

client side: start here > run samples > upload file
server side: function web_upload in webfunc.prg

Best regards,
Boris Borzic
-- news://news.Xb2.NET
http://www.Xb2.NET
http://www.SQLExpress.net
industrial strength Xbase++ development tools