以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  找不到文件。。。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=54585)

--  作者:fubblyc
--  发布时间:2014/7/31 9:46:00
--  找不到文件。。。
各位老师好,

Dim vtxt As String = "Version.txt"
Dim pzip As String = "Publish.zip"
Dim utxt As String = "update.txt"
Dim uzip As String = "update.zip"

Dim ftp As New FTPClient
ftp.Host = "42.51.152.221"
ftp.Account = "abc"
ftp.Password = "abcdef"
ftp.Port = "21"
ftp.RootDir = "\\fox\\lls\\Update" \'如果升级所需文件刚好放置在FTP的根目录下,可以不用设置此属性;否则需要设置目录路径.
\'ftp.RootDir = "\\升级文件所在目录"

Dim zip As New ZipFile

\'连接FTP服务器--------------------
If ftp.Connected = False \'如果FTP没有连接
    If ftp.Connect Then \'连接FTP
   \'     MessageBox.Show("FTP服务器连接成功!")
    Else
        MessageBox.Show("FTP服务器连接失败!")
        Return
    End If
End If

\'检测升级所需的4个文件--------------------
If ftp.FileExists(vtxt) = False OrElse ftp.FileExists(pzip) = False OrElse ftp.FileExists(utxt) = False OrElse ftp.FileExists(uzip) = False Then
    MessageBox.Show("服务器缺少升级所需文件!" & vbcrlf & vtxt & "  " & pzip & "  " & utxt & "  " & uzip,"提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
    Return
End If


图片点击可在新窗口打开查看此主题相关图片如下:ftp.jpg
图片点击可在新窗口打开查看


明明FTP上有,

项目却死活 执行了这条代码:

 MessageBox.Show("服务器缺少升级所需文件!" & vbcrlf & vtxt & "  " & pzip & "  " & utxt & "  " & uzip,"提示",MessageBoxButtons.OK,MessageBoxIcon.Error)

不知道什么情况。。。 



--  作者:有点甜
--  发布时间:2014/7/31 9:54:00
--  

加入代码一个一个试

msgbox(ftp.FileExists(vtxt))
msgbox(ftp.FileExists(p.RootDir & "\\" & vtxt))
msgbox(ftp.FileExists("/fox/lls/Update/" & vtxt))

 


--  作者:fubblyc
--  发布时间:2014/7/31 10:12:00
--  
甜老师,

msgbox(ftp.FileExists(vtxt))   提示  TRUE
msgbox(ftp.FileExists(p.RootDir & "\\" & vtxt))  这句没有测试。。。
msgbox(ftp.FileExists("/fox/lls/Update/" & vtxt))   提示  TRUE

--  作者:有点甜
--  发布时间:2014/7/31 10:15:00
--  

 回复3楼,接着测试其它的呗,看哪一个有问题

 

Dim vtxt As String = "Version.txt"
Dim pzip As String = "Publish.zip"
Dim utxt As String = "update.txt"
Dim uzip As String = "update.zip"

--  作者:fubblyc
--  发布时间:2014/7/31 10:20:00
--  
甜老师,全部为 TRUE

MessageBox.Show(ftp.FileExists(vtxt))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & vtxt))

MessageBox.Show(ftp.FileExists(pzip))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & pzip))

MessageBox.Show(ftp.FileExists(utxt))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & utxt))

MessageBox.Show(ftp.FileExists(uzip))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & uzip))


--  作者:fubblyc
--  发布时间:2014/7/31 10:21:00
--  
难道是我FTP空间的问题??
--  作者:Bin
--  发布时间:2014/7/31 10:22:00
--  
全部为True怎么可能进入IF里面呢.
--  作者:fubblyc
--  发布时间:2014/7/31 10:24:00
--  
Bin老师,不明白您什么意思。。。

我是这样写的:

Dim vtxt As String = "Version.txt"
Dim pzip As String = "Publish.zip"
Dim utxt As String = "update.txt"
Dim uzip As String = "update.zip"

Dim uvtxt As String = utmp & "\\Version.txt"
Dim upzip As String = utmp & "\\Publish.zip"
Dim uutxt As String = utmp & "\\update.txt"
Dim uuzip As String = utmp & "\\update.zip"

Dim ftp As New FTPClient
ftp.Host = "42.51.152.221"
ftp.Account = ""
ftp.Password = ""
ftp.Port = "21"
ftp.RootDir = "\\fox\\lls\\Update" \'如果升级所需文件刚好放置在FTP的根目录下,可以不用设置此属性;否则需要设置目录路径.
\'ftp.RootDir = "\\升级文件所在目录"

Dim zip As New ZipFile

\'连接FTP服务器--------------------
If ftp.Connected = False \'如果FTP没有连接
    If ftp.Connect Then \'连接FTP
   \'     MessageBox.Show("FTP服务器连接成功!")
    Else
        MessageBox.Show("FTP服务器连接失败!")
        Return
    End If
End If

MessageBox.Show(ftp.FileExists(vtxt))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & vtxt))

MessageBox.Show(ftp.FileExists(pzip))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & pzip))

MessageBox.Show(ftp.FileExists(utxt))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & utxt))

MessageBox.Show(ftp.FileExists(uzip))
\'MessageBox.Show(ftp.FileExists(RootDir & "\\" & vtxt))
MessageBox.Show(ftp.FileExists("/fox/lls/Update/" & uzip))

\'检测升级所需的4个文件--------------------
If ftp.FileExists(vtxt) = False OrElse ftp.FileExists(pzip) = False OrElse ftp.FileExists(utxt) = False OrElse ftp.FileExists(uzip) = False Then
    MessageBox.Show("服务器缺少升级所需文件!" & vbcrlf & vtxt & "  " & pzip & "  " & utxt & "  " & uzip,"提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
    Return
End If

[此贴子已经被作者于2014-7-31 10:24:46编辑过]

--  作者:Bin
--  发布时间:2014/7/31 10:26:00
--  
全部为TRUE

怎么可能符合这个IF条件呢

If ftp.FileExists(vtxt) = False OrElse ftp.FileExists(pzip) = False OrElse ftp.FileExists(utxt) = False OrElse ftp.FileExists(uzip) = False Then
    MessageBox.Show("服务器缺少升级所需文件!" & vbcrlf & vtxt & "  " & pzip & "  " & utxt & "  " & uzip,"提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
    Return
End If

--  作者:fubblyc
--  发布时间:2014/7/31 10:29:00
--  
Bin 老师,但是提示就是这样:


图片点击可在新窗口打开查看此主题相关图片如下:缺少.png
图片点击可在新窗口打开查看