Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enviar arquivos em HTTP
Message
 
À
25/08/2004 16:57:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00935534
Message ID:
00936717
Vues:
23
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á:


*******************************
'code in a form with a Inet Control and a command button
Option Explicit

Private Sub Command1_Click()
Dim strPostData As String
Dim strHeader As String
Dim strData As String

Open "c:\test1.txt" For Binary As #2 'open a heavy file for sending as POST DATA
strData = Input(FileLen("C:\test1.txt"), #2) 'get the file contents in the variable
Close #2 'close the file

'prepare the post string
strPostData = "Test_name=" & strData & "&Test_age=10" & vbCrLf
'prepare teh header string
strHeader = "Content-Type: application/x-www-form-urlencoded" & vbCrLf
'open the url
Inet1.Execute "","http://server1/test/test1.asp '_blank'>http://server1/test/test1.asp", "POST", strPostData, strHeader


End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim strResponse As String
Dim vtData As Variant

Select Case State
Case 12 'if it goes inside, then the transfer has been completed
Do
vtData = Inet1.GetChunk(100, icString) 'get the chunk of data
strResponse = strResponse & vtData 'append the data to the final string
Loop Until Len(vtData) = 0

'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
End Select
End Sub
Cordialmente,

Fabiano Costa
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform