Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uploading file via HTTP
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00819019
Message ID:
00819562
Views:
12
Here is some code for our product, if you want to try it.
The installer is located here:
http://www.seekfordsolutions.com/Products/Files/InternetProtocolWizardToolpack/IPToolpackv2.exe
or download #17521
Also note, if you send your project requirements to softeng@seekfordsolutions.com an engineer may be able to give you source code to fulfill your project requirements as far as our product implementation goes. This of course if its a simplistic implementation.
 	&&Declare the FormBuilder object
    local obForm 
    obForm = CreateObject("HTTPWizard.FormBuilder2")
    &&The headers object we pass
    local obHeaders 
    obHeaders = CreateObject("HTTPWizard.HTTPHeaders2")
    &&The response object we will use
    local obResponse 
    &&This will check the data for the response
    local sDataCheck
        
    &&Simplify access to the obForm object
    &&Setup the variables with the User Information
    &&It is very easy to expand on the logic show below
    &&simply adding new variables requires only a new line of code
    &&remember, the first parameter is the variable name tne server uses to access the value
    &&the second parameter is the value associated with the variable named
    
     &&Set the First Name value
	&&obForm.AddFormVar( "pFirstName", THISFORM.txtName.value)
    &&Set the Address value
    &&obForm.AddFormVar( "pAddress", THISFORM.txtAddress.value)
    &&Set the EMail address value
    &&obForm.AddFormVar( "pEmail", THISFORM.txtEmail.value)
    &&Set the Serial Number value
    &&obForm.AddFormVar( "pSerial", THISFORM.txtSerial.value)
    
    obForm.AddFile(TRIM(THISFORM.txtFileName.text),TRIM(THISFORM.txtVariableName.text))
    
    &&This is the URI of where to POST the form data to.
    &&below is the test URI we have setup for demonstration purposes Test Page does not currently support files yet.
    &&    obForm.URI =   "/CustomWork/HTTPTests/UserRegistrationExample.asp"
    obForm.URI = TRIM(THISFORM.txtURI.text)

    &&Now we are going to post the data to the server
    &&afterwards we will check the response if we need to
    
    &&Here we set the server name to the proper server
    THISFORM.HTTPWizard1.ServerName = TRIM(THISFORM.txtServerName.text)
    &&we arent using SSL so we set this to false.
    THISFORM.HTTPWizard1.UseSSL = .f.
    &&We set the port to the standard port 80
    &&If using SSL it should probably be 443
    THISFORM.HTTPWizard1.ServerPort = 80
    
    &&Now we invoke the command, no need to connect since the command automatically connects for us
    obResponse = THISFORM.HTTPWizard1.FileUpload(obHeaders, obForm)
    If (obResponse = NULL) Then
        MessageBox( "Error uploading data: " + HTTPWizard1.LastServerResponseDescription)
    Else
        &&successful so we start interpreting the data if we want to
        sDataCheck = obResponse.Body
        MessageBox(sDataCheck)
    EndIf
>Hi Brian,
>
>I'm still looking for the best (easiest) solution for this particular project.
>
>Thanks,
>Arriyel
>
>>Are you currently shopping around for solutions or is the ipStuff the product you have chosen for you project?
>>
>>>Hi,
>>>
>>>I'm working on a project for uploading files via HTTP to a secure site. I'm using xxIPStuff to see if it will do the job but I keep getting a 'The server name or address could not be resolved' error message. I can't give out the User name and pass word but here is the code I am using.
>>>
>>>
>>>*** Sending Files via HTTP from a VFP client
>>>#INCLUDE WCONNECT.h
>>>SET PROCEDURE TO wwUtils ADDITIVE
>>>SET CLASSLIB TO wwIPStuff ADDITIVE
>>>
>>>CLEAR
>>>
>>>oHTTP = CREATEOBJECT("wwHTTP")
>>>
>>>*** Connect to the server
>>>oHTTP.HTTPConnect("https://www.aesdirect.gov/aesdirect/system/entry.cgi?p_action=BU", "UserName", "PassWord", .T.)
>>>
>>>*** Initialize the variables that will be filled by HTTPGetEx
>>>lcHTML=""     && Data buffer
>>>lnText=0      && Size of the output to return - 0 means autosize
>>>
>>>*** Send the POST data and retrieve HTTP result
>>>oHTTP.nHTTPPostMode = 2
>>>oHTTP.AddPostKey("filename", "C:\EXPORTVSS\AES_OUT\UPTEST01.000", .T.)
>>>lnResult = oHTTP.HTTPGetEx("/aesdirect/system/fup.cgi",@lcHTML,@lnText)
>>>oHTTP.nHTTPPostMode = 1
>>>IF lnResult # 0
>>>   WAIT WINDOW ALLTRIM(STR(lnResult)) + " - " + oHTTP.cErrorMsg NOWAIT
>>>   RETURN
>>>ENDIF
>>>
>>>? TRIM(lcHTML)
>>>
>>>oHTTP.HTTPClose()   && Close the connection
>>>
>>>RETURN
>>>
>>>
>>>Any help is greatly appreciated.
>>>
>>>Thanks,
>>>Arriyel
Brian Seekford
Seekford Solutions, Inc.
http://www.SeekfordSolutions.com
Internet ActiveX Controls and .NET Class Libraries.
SMTP/S FTP POP3/S HTTP/S SNTP MIME PING WHOIS TRACEROUTE NNTP DNS MX
Base64, UUEncode, yEnc, MD5, SHA1, URL, Quoted-Printable.
Resizer and Tooltips
Email Verification and more. Check us out!
Previous
Reply
Map
View

Click here to load this message in the networking platform