-
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
-
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