Archived Forum Post

Index of archived forum posts

Question:

Demo doesn't work for me

May 18 '14 at 14:07

Hi,

I've tried this example : http://www.example-code.com/vb/http_upload_with_params.asp

I get error -1 and the msgbox saying Unlocked trial ....

success = http.UnlockComponent("Anything for 30-day trial") If (success <> 1) Then MsgBox http.LastErrorText Exit Sub End If

But still does not work.

Then on the next check i get again the error on this part here :

success = req.AddFileForUpload("file2","dude.gif") If (success <> 1) Then MsgBox req.LastErrorText Exit Sub End If

I would really want to try this and if it works i would definitely buy it.

Regards,

B.


Answer

Sounds like you trial expired? Can you post the exact contents of the LastErrorText at the first failing method?


Answer

Sure...

Here it is :

alt text

http://i.imgur.com/QZYr0dw.png


Answer

It looks like you are using the VB6 examples in VB.net. I had a quick look at the .Net examples, and they use a boolean datatype for success checks (instead of Long).

Instead you should try:

Dim success As boolean

success = http.UnlockComponent("Anything for Trial")

if (success <> true) then
    ' Show error
end if

etc...


Answer

Ok, then i get this ... on the next step down

alt text

Then when i click once more i get this

alt text


Answer

But it does not start any kind of upload...

     Dim success As Boolean
        Dim http As New Chilkat.Http

'  Any string unlocks the component for the 1st 30-days.
        success = http.UnlockComponent("Hello World")

If (success <> 1) Then
            MsgBox(http.LastErrorText)
            Exit Sub
        End If

'  Build a HTTP request with the files to be uploaded:
        Dim req As New Chilkat.HttpRequest
        req.UseUpload()

'  The URL we'll be posting to is:

'  Therefore, the path part of the URL is:
        req.Path = "/cgi-bin/up_flash.cgi"

'  Note: You may test uploads to this URL, but anything over 80K will be aborted on the receiving side.

'  Add some files to the request:
        '  The 1st argument is an arbitrary name.  It's the POST form field name.
        '  The 2nd argument is the filename currently existing on
        '  the local filesystem.  It may include an absolute or relative
        '  path, or no path at all if it's in the current working directory.
        success = req.AddFileForUpload("Filedata", "C:\test.txt")
        If (success <> 1) Then
            MsgBox(req.LastErrorText)
            Exit Sub
        End If

'  Additional non-file params may be added to the POST request
        '  by calling AddParam:
        req.AddParam("sess_id", "0z2oo0y9libd9i9t")
        req.AddParam("Filename", "test.jpg")
        req.AddParam("folder", "\")
        req.AddParam("Upload", "Submit Query")

'  Send the HTTP POST and get the response.  Note: This is a blocking call.
        '  The method does not return until the full HTTP response is received.
        Dim domain As String
        Dim port As Long
        Dim ssl As Long
        domain = "http://skizzle12.terafile.co"
        port = 80
        ssl = 0
        Dim resp As Chilkat.HttpResponse
        resp = http.SynchronousRequest(domain, port, ssl, req)
        If (resp Is Nothing) Then
            TextBox1.Text = TextBox1.Text & http.LastErrorText & vbCrLf
        Else
            '  Display the HTML source of the page returned.
            TextBox1.Text = TextBox1.Text & resp.BodyStr & vbCrLf
        End If