#chilkat
Вопрос:
Мой хостер обновил кое-что о моем сервере, я думаю, версию php, и с тех пор мой скрипт загрузки php больше не работает с Chilkat.Загрузка.
Dim _Chil As New Chilkat.Upload
_Chil.Ssl = True
_Chil.Hostname = "www.example.com"
_Chil.Path = "/upload.php"
_Chil.AddFileReference("file", "D:test.txt")
Dim bUploadStarted As Boolean = _Chil.BeginUpload()
If Not bUploadStarted Then
MessageBox.Show("Error trying to BeginUpload: " amp; _Chil.LastErrorText)
Return
End If
Do While _Chil.UploadInProgress
_Chil.SleepMs(200)
Loop
Dim bSuccess As Boolean = _Chil.UploadSuccess
If Not bSuccess Then
MessageBox.Show("Error uploading:" amp; _Chil.LastErrorText)
Else
MessageBox.Show("Upload succeeeded. :-)")
End If
При .Ssl = true
загрузка BeginUpload завершается неудачно. Это последний текст ошибки:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 1
Connecting directly to HTTP server
domain: www.example.com
port: 80
socket2Connect:
connect2:
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
connectFailReason: 103
Failed to read the TLS server hello. Retry without TLS 1.3
connectImplicitSsl:
clientHandshake:
clientHandshake2:
readHandshakeMessages:
Failed to read TLS record (2)
tlsRec_msg: 0
msgLen: 20527
nReadNBytes: 0
status: 0
--readHandshakeMessages
--clientHandshake2
--clientHandshake
Client handshake failed. (3)
--connectImplicitSsl
ConnectFailReason: 103
--connect2
--socket2Connect
--BeginUpload
--ChilkatLog
Если я удалю .Ssl = true, то BeginUpload завершится успешно, но UploadSuccess вернет false. Тогда последний текст ошибки будет:
ChilkatLog:
BeginUpload:
DllDate: Aug 28 2021
ChilkatVersion: 9.5.0.88
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
Language: .NET 4.6 / x86 / VS2015
VerboseLogging: 0
usingTls: 0
Connecting directly to HTTP server
domain: www.example.com
port: 80
--BeginUpload
Если я запущу скрипт через браузер, он будет работать нормально.
Вот мой код:
myform.php:
<center>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" >
<input type="submit" name="upload" value="upload file">
</form>
</center>
upload.php:
<?php
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
?>
Ответ №1:
HTTPS использует порт 443.
Поэтому, используя
_Chil.Port = 443
устраняет проблему.