Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enviar arquivos em HTTP
Message
De
26/08/2004 15:01:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00935534
Message ID:
00936735
Vues:
20
>Eu achei a rotina que necessito, mas esta na jaca do VB6 e não consigo reproduzir ela no VFP (não entendo muita coisa de VB)
>
>Se alguem puder me dar uma força, agradeço desde já:
>
>
Prezado sr. VFP developer..

tente mais ou menos isto:
* 'code in a form with a Inet Control and a command button

procedure thisform.Command1.Click()
vfpCrLf     = chr(13) + chr(10)
strPostData = ""
strHeader   = ""
strData     = ""

strData     = filetostring(c:\test1.txt")

* 'prepare the post string
strPostData = "Test_name=" + strData + "&Test_age=10" + vfpCrLf
* 'prepare teh header string
strHeader   = "Content-Type: application/x-www-form-urlencoded" + vfpCrLf
* 'open the url
Inet1       = InternetOpen("Wininet",0,.NULL.,.NULL.,0)

Inet1.Execute( "","http://server1/test/test1.asp '_blank'>http://server1/test/test1.asp", "POST",  strPostData, strHeader)
EndPROC


* acho que daqui em diante é só para controle.. não será necessário
function Inet1.StateChanged
lparameters State
strResponse = ""
vtData      = ""

if  state = 12                                 && if it goes inside, then the transfer has been completed
    Do while Len(vtData) = 0
       vtData = Inet1.GetChunk(100, icString)  && 'get the chunk of data
       strResponse = strResponse + vtData      && 'append the data to the final string
    enddo
    * 'write the data to a file to see if it has been correctly installed
    *Open "c:\test2.txt" For Output As #2       && 'open the file for output
    *Print #2, strResponse                      && 'print the contents
    *Close #2                                   && 'close the file
    copy file "c:\test2.txt" to print
Endif
endfunc
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform