J'ai trouvé un code qui permet d'envoyer des fichiers sur un ftp. Le prog marche qu'en j'envoie des pages html, mais dès que j'envoie une base access, elle est corrompue sur le FTP et j'aimerais savoir pourquoi
Public Sub UploadFile(ByVal sFileName As String, _ByVal bResume As Boolean)
Dim cSocket As Socket
Dim offset As Long
Dim input As FileStream
Dim bFileNotFound As Boolean
If (Not (m_bLoggedIn)) Then
Login()
End If
cSocket = CreateDataSocket()
offset = 0
If (bResume) Then
Try
SetBinaryMode(
True)
offset = GetFileSize(sFileName)
Catch ex As Exception
offset = 0
End Try
End If
If (offset > 0) Then
SendCommand("REST " & offset)
If (m_iRetValue <> 350) Then
'The remote server may not support resuming.
offset = 0
End If
End If
'Send an FTP command to store a file.
SendCommand("STOR " & Path.GetFileName(sFileName))
If (Not (m_iRetValue = 125 Or m_iRetValue = 150)) Then
MessageString = m_sReply
Throw New IOException(m_sReply.Substring(4))
End If
'Check to see if the file exists before the upload.
bFileNotFound =
False
If (File.Exists(sFileName)) Then
' Open the input stream to read the source file.
input =
New FileStream(sFileName, FileMode.Open)
If (offset <> 0) Then
input.Seek(offset, SeekOrigin.Begin)
End If
'Upload the file.
m_iBytes = input.Read(m_aBuffer, 0, m_aBuffer.Length)
Do While (m_iBytes > 0)
cSocket.Send(m_aBuffer, m_iBytes, 0)
m_iBytes = input.Read(m_aBuffer, 0, m_aBuffer.Length)
Loop
input.Close()
Else
bFileNotFound =
True
End If
If (cSocket.Connected) Then
cSocket.Close()
End If
'Check the return value if the file was not found.
If (bFileNotFound) Then
MessageString = m_sReply
Throw New IOException("The file: " & sFileName & " was not found. " & _
"Cannot upload the file to the FTP site")
End If
ReadReply()
If (Not (m_iRetValue = 226 Or m_iRetValue = 250)) Then
MessageString = m_sReply
Throw New IOException(m_sReply.Substring(4))
End If
End Sub