VB中如何实现上传文件的功能?

来源:百度知道 编辑:UC知道 时间:2024/04/24 08:31:03
VB中如何实现上传文件的功能,主要是要实现如用CommonDialog1.ShowOpen后得到的文件上传(复制)到程序运行的目录下的指定目录中(如app.path\content\).

用script脚本 直接调用 FTP 命令实现上传文件到FTP服务器。

代码如下:

'定义API函数
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFFFFFF
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Private Sub Command1_Click()
Dim filename As String
Dim ftp As String
Dim uname As String