filecopy就可以在网络上的机子之间拷东西啊。可是服务器不给你权限你怎么拷东西到服务器的硬盘呢?你至少得得到服务器的用户名、密码。然后用VB写一个bat批处理文件,上面用net use命令获得服务器权限。格式是-----net use \\服务器名\路径 password /user:username用VB的shell执行这个bat再用filecopy拷到服务器相应目录之下即可。
其实就是ftp程序阿可以用winsock做一个ftp客户端
我要上传的话肯定是知道了FTP的地址,还有用户名和密码的net use \\服务器名\路径 password /user:username 这个格式如何实现?还有请问online(龙卷风(白学了,重新充电中)) 怎么做FTP程序呀,介绍一点相关资料,谢谢
用ftp控件 简单 也可以有api
使用winsock控件 Private Sub Command1_Click() Command1.Enabled = False Command2.Enabled = True While Winsock2.State <> sckConnected Timer2.Enabled = True DoEvents Wend Dim i As Integer LnFile = FileLen(srcFile) nLoop = 0 ReDim Buffer(maxByte) Open srcFile For Binary Access Read As #1
Winsock1.SendData "SF" DoEvents Winsock1.SendData Text1.Text DoEvents serResponse = "" Do If CtrlCommand <> False Then Exit Do End If strMessage = "正在发送文件…" If (nLoop + maxByte + 1) < LnFile Then Get #1, , Buffer '每次读 1024 个位元组 Winsock1.SendData "SendDatas" DoEvents While serResponse <> "Ready" DoEvents Wend serResponse = "" Winsock2.SendData Buffer DoEvents nLoop = nLoop + maxByte + 1 Else nLoop = LnFile - nLoop - 1 ReDim Buffer(nLoop) Get #1, , Buffer '每次读 1024 个位元组 Winsock1.SendData "SendDatas" DoEvents While serResponse <> "Ready" DoEvents Wend serResponse = "" Winsock2.SendData Buffer DoEvents Exit Do End If Loop Close #1 If CtrlCommand = False Then Winsock1.SendData "SendComplete" DoEvents strMessage = "文件发送完毕!" Command2.Enabled = False Else Winsock1.SendData "Cancel" DoEvents strMessage = "取消文件发送!" CtrlCommand = False End If Winsock2.Close End Sub
也可以有api
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = True
While Winsock2.State <> sckConnected
Timer2.Enabled = True
DoEvents
Wend
Dim i As Integer
LnFile = FileLen(srcFile)
nLoop = 0 ReDim Buffer(maxByte)
Open srcFile For Binary Access Read As #1
Winsock1.SendData "SF"
DoEvents
Winsock1.SendData Text1.Text
DoEvents
serResponse = ""
Do
If CtrlCommand <> False Then
Exit Do
End If
strMessage = "正在发送文件…"
If (nLoop + maxByte + 1) < LnFile Then
Get #1, , Buffer '每次读 1024 个位元组
Winsock1.SendData "SendDatas"
DoEvents
While serResponse <> "Ready"
DoEvents
Wend
serResponse = ""
Winsock2.SendData Buffer
DoEvents
nLoop = nLoop + maxByte + 1
Else
nLoop = LnFile - nLoop - 1
ReDim Buffer(nLoop)
Get #1, , Buffer '每次读 1024 个位元组
Winsock1.SendData "SendDatas"
DoEvents
While serResponse <> "Ready"
DoEvents
Wend
serResponse = ""
Winsock2.SendData Buffer
DoEvents
Exit Do
End If
Loop
Close #1
If CtrlCommand = False Then
Winsock1.SendData "SendComplete"
DoEvents
strMessage = "文件发送完毕!"
Command2.Enabled = False
Else
Winsock1.SendData "Cancel"
DoEvents
strMessage = "取消文件发送!"
CtrlCommand = False
End If
Winsock2.Close
End Sub
vb网络编程从入门到精通源码
其中第十章的例子为ftp
只要客户端与服务器端配合好,上传的方法很多,关键是“配合”
或者net use \\server\相应路径 111 /user:admin在批处理中执行了以上命令,你就获得了向服务器直接filecopy的权利了。那个相应路径指的是服务器硬盘上的与网址对应的路径(你需要知道IIS的设置),而不是网址路径。这种方法在局域网的维护中更为常见。在互联网上,还要考虑到服务器防火墙设置的问题,要让它给你留个通道。这个法子,相比较ftp而言,简单些,不过有点不太正规。偶赞同楼上的意见,方法有很多,关键是“配合”。能用就行。