|
|
' ------------------------------------------------------
' アップロード
' ------------------------------------------------------
Public Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" ( _
ByVal hFtpSession As Long, _
ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, _
ByVal dwContext As Long _
) As Boolean
| |
|
|
|
|
' ******************************************************
' アップロード
' ******************************************************
Public Function lbFTPUpload( _
RemoteTarget As String, _
LocalTarget As String _
) As String
Dim bRet As Boolean
Dim nLastDllError As Long
bRet = FtpPutFile( _
hCon, _
LocalTarget, _
RemoteTarget, _
FTP_TRANSFER_TYPE_BINARY, _
0)
nLastDllError = Err.LastDllError
If bRet Then
lbFTPUpload = ""
Else
lbFTPUpload = "(" & nLastDllError & ") " & Err.Description
End If
End Function
| |
|
|
|
|
' ******************************************************
' ファイルを一つアップロード
' ******************************************************
Private Sub cmdアップロード_Click()
Dim strPath As String
Dim strRet
Dim strWork
strPath = ""
If COMMONDLG.OpenFileDlg("ファイルを選択", Me.hWnd, "全て,*.*", 1, strPath) Then
If vbOK = MsgBox("アップロードを開始します。よろしいですか?", vbOKCancel) Then
strWork = Split(strPath, "\")
strRet = Module1.lbFTPUpload("cgi-bin/" & strWork(UBound(strWork)), strPath)
If strRet <> "" Then
MsgBox (strRet)
Else
MsgBox ("アップロードが終了しました")
End If
End If
End If
End Sub
| |
|
|
|