Results 1 to 2 of 2

Thread: cannot upload file

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    1

    cannot upload file

    hi.
    can someone help me out?
    my codes are running well without errors but the files that i want to upload still not uploading to my localhost. below i copy the entire code.

    plus, i'm using ChilkatUpload ActiveX Reference (Visual Basic). oh ya! for your information, i detect that do-while is not looping after debugging. pls help me.thanks!

    ----------------------------------------------------------------------------------------------------------------------

    Private Sub Command1_Click()
    Dim upload As New ChilkatUpload

    ' Specify the page (ASP, ASP.NET, Perl, Python, Ruby, CGI, etc)
    ' that will process the HTTP Upload.
    ' You must change these values to your hostname/path.
    upload.HostName = "https://localhost"
    upload.Path = "/testv/"

    ' To upload via HTTPS, you only need to set the port
    ' and "Ssl" property. All other programming remains the same:
    upload.Ssl = 1
    upload.Port = 443

    ' Add one or more files to be uploaded.
    upload.AddFileReference "file1", "D:\try\a.txt"
    upload.AddFileReference "file2", "D:\try\logo_abmb.gif"
    'upload.AddFileReference "file3", "sample.doc"

    ' Begin the HTTPS upload in a background thread:
    Dim success As Long
    success = upload.BeginUpload()
    If (success <> 1) Then
    MsgBox upload.LastErrorText
    Else
    MsgBox "Files uploaded!"
    End If

    ' Wait for the upload to finish.
    ' Print the progress as we wait...
    Do While (upload.UploadInProgress = 1)
    ' We can abort the upload at any point by calling:
    ' upload.AbortUpload
    ' uploadFile = True
    ' upload.BeginUpload

    ' Display the percentage complete and the number of bytes uploaded so far..
    ' The total upload size will become set after the upload begins:
    Text1.Text = Text1.Text & upload.PercentUploaded & "% " & upload.NumBytesSent & "/" & upload.TotalUploadSize & vbCrLf

    ' Sleep 2/10ths of a second.
    upload.SleepMs 200

    Loop

    ' Did the upload succeed?
    If (upload.UploadSuccess = 1) Then
    MsgBox "Files uploaded!"
    Else
    MsgBox upload.LastErrorText

    End If

    End Sub
    Last edited by eimima85; Jul 24th, 2008 at 10:07 PM.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: cannot upload file

    I believe your issue is with these 2 lines of code:
    Code:
    upload.HostName = "https://localhost"
    upload.Path = "/testv/"
    From their site example, the HostName property should begin with "www." - I would imagine you can drop the HTTPS:// specifier and that the result of the SSL property would tell the component whether to prefix this string with either HTTP:// or HTTPS://.

    With the Path property, this should be pointing to an ASP or similar code processing file upon the webserver, and not a folder as you have. The example from their site again, lists the value for this property in the format "/receiveUpload.asp", and there is a full example of the code needed for this receiveUpload page shown upon this webpage - http://www.chilkatsoft.com/p/p_534.asp

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width