asp 中使用Ftp.exe 上传大文件
生活随笔
收集整理的這篇文章主要介紹了
asp 中使用Ftp.exe 上传大文件
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
'參數說明:FTP 服務器 ;帳號 ; 密碼 ;要上傳的文件名(需要完整路徑),FTp虛擬目錄名稱?
Function upFile(ftp_address, ftp_username, ftp_password , uploadfilename, FtpServerName)
??? Dim oScript, objFSO
??? Dim TempFilePath?
??? Dim objTextFile, strCMD
?
??? Set oScript = CreateObject("WSCRIPT.SHELL")
??? Set objFSO = CreateObject("Scripting.FileSystemObject")
??? TempFilePath = objFSO.GetSpecialFolder(2) '臨時目錄
??? Set objTextFile = objFSO.CreateTextFile(TempFilePath & "\test.ftp")
??? objTextFile.WriteLine "open " & ftp_address?? 'FTP 服務器地址
??? objTextFile.WriteLine ftp_username??????????? '登錄FTP的帳號名
??? objTextFile.WriteLine ftp_password??????????? '登錄FTP的密碼
??? objTextFile.WriteLine "bin? "
??? objTextFile.WriteLine "cd? /" & FtpServerName & "/" 'FTP站點名稱
??? objTextFile.WriteLine "put " & uploadfilename? ' 上傳文件的路徑
??? objTextFile.WriteLine "bye"
???
??? objTextFile.Close
??? Set objTextFile = Nothing
??? strCMD = "ftp.exe -s:" & TempFilePath & "\test.ftp"
??? Call oScript.Run(strCMD, 0, True)
??? Set objFSO = Nothing
??? Set oScript = Nothing
End Function
Function upFile(ftp_address, ftp_username, ftp_password , uploadfilename, FtpServerName)
??? Dim oScript, objFSO
??? Dim TempFilePath?
??? Dim objTextFile, strCMD
?
??? Set oScript = CreateObject("WSCRIPT.SHELL")
??? Set objFSO = CreateObject("Scripting.FileSystemObject")
??? TempFilePath = objFSO.GetSpecialFolder(2) '臨時目錄
??? Set objTextFile = objFSO.CreateTextFile(TempFilePath & "\test.ftp")
??? objTextFile.WriteLine "open " & ftp_address?? 'FTP 服務器地址
??? objTextFile.WriteLine ftp_username??????????? '登錄FTP的帳號名
??? objTextFile.WriteLine ftp_password??????????? '登錄FTP的密碼
??? objTextFile.WriteLine "bin? "
??? objTextFile.WriteLine "cd? /" & FtpServerName & "/" 'FTP站點名稱
??? objTextFile.WriteLine "put " & uploadfilename? ' 上傳文件的路徑
??? objTextFile.WriteLine "bye"
???
??? objTextFile.Close
??? Set objTextFile = Nothing
??? strCMD = "ftp.exe -s:" & TempFilePath & "\test.ftp"
??? Call oScript.Run(strCMD, 0, True)
??? Set objFSO = Nothing
??? Set oScript = Nothing
End Function
轉載于:https://www.cnblogs.com/shuxx/archive/2007/08/28/873231.html
總結
以上是生活随笔為你收集整理的asp 中使用Ftp.exe 上传大文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 列出本机安装的所有硬件设备
- 下一篇: VS2005发布网站问题及aspnet_