Ariston Santos Posted December 15, 2020 Report Share Posted December 15, 2020 Boa tarde, Estou procurando uma solução para upload de imagens que não seja via FTP. A ideia é seria uma solução semelhando à demonstrada abaixo, usando a TIpLib para upload de XML via POST. Queria saber se tem como enviar imagens da mesma forma. cDBHst := IIF("localhost" $ c_Host, "http://"+alltrim(c_Host), "http://www."+alltrim(c_Host)) TRY oURL1 := TUrl():New(cDBHst+"/"+c_Php+"?uid="+GeraIdUnico()) oHtp1 := TIpClientHttp():New(oURL1, .F.) oHtp1:nConnTimeout:= 3000 // 3 segundos if oHtp1:Open() If oHtp1:POST( {{"xml", c_Xml}} ) // POST acepts long queries, xml and json. _Json := oHtp1:ReadAll() Else SysRefresh() ; MsgInfo('Erro no Post ' + cDBHst, 'Aviso do Sistema') EndIf Else SysRefresh() ; MsgInfo("Erro na conexão com "+cDBHst+"/"+c_Php, "Atenção") EndIf try ; oHtp1:Close() ; catch e ; end try try ; DeleteObject(oURL1) ; catch e ; end try try ; DeleteObject(oHtp1) ; catch e ; end try DeleteUrlCacheEntry(oURL1) CATCH oErr SysRefresh() ; MsgAlert("Erro: "+oErr:Description, "Ocorreu um erro") END IF ! EMPTY(_Json) MsgHtml(_Json, "Retorno de "+cDBHst) EndIf Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 16, 2020 Report Share Posted December 16, 2020 Não serve? URLDownloadToFile Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 16, 2020 Report Share Posted December 16, 2020 Eu acho que aqui tem mais alguma coisa, mas eu não tenho certeza: http://forums.fivetechsupport.com/viewtopic.php?f=6&t=34903&start=15&hilit=upload Abs. Quote Link to comment Share on other sites More sharing options...
Ariston Santos Posted December 16, 2020 Author Report Share Posted December 16, 2020 Não, mestre. Essa função faz download. O que preciso é fazer upload. Obrigado por responder. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.