国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

關于大文件上傳的FTP解決方案

2024-07-21 02:15:43
字體:
來源:轉載
供稿:網友
    用asp.net上傳文件時,對大文件的處理總會不盡于人意,雖然從理論上講,可以傳輸很大的文件(100m以上),但在實際使用中會出現各種問題.因此,基于b/s架構的大文件上傳還是用ftp為好。

 用ftp手工上傳文件沒有什么可以說的,但我們往往需要通過程序來控制這一過程,即通過asp.net來實現這一目的.如果ftp軟件具備可二次開發的接口就好了.經典的cuteftp pro就具有這樣的功能。

 安裝完cuteftp pro 7后,會生成一個文件叫ftpte(ftp傳輸引擎),ftpte提供了很多屬性和方法,能夠方便地通過編程來實現大文件的上傳,包括文件過濾、目錄和文件檢測、文件刪除、改名、傳輸啟動和停止以及狀態查看等等。

 下面是實例:

 連接ftp服務器:

set mysite = createobject("cuteftppro.teconnection")

mysite.protocol = "ftp"

mysite.host = "ftp.cuteftp.net"

mysite.login = "username"

mysite.password = "password"

mysite.connect

 上傳文件:

set mysite = createobject("cuteftppro.teconnection")

‘specify user, pass, host, and connect as normal...

mysite.connect ‘recommended: call connect first

mysite.remotefolder = "temp"

mysite.localfolder = "c:/123"

‘using relative path, all files in folder 123 are uploaded to the folder temp off the current folder on the server.

mysite.upload "*.*"

 下載文件:

set mysite = createobject("cuteftppro.teconnection")

‘specify user, pass, host, and connect as normal...

mysite.connect ‘recommended: call connect first

‘next line changes to a predetermined folder so you can use a relative path in the download method

mysite.remotefolder = "/c:/inetpub/ftproot/temp/temp/"

msgbox (mysite.remotefolder) 'display current remote folder

mysite.download "agent.ini", "c:/temp/agent1.ini"

'now verify downloaded ok

if cbool(mysite.localexists ("c:/temp/agent1.ini")) then

msgbox "file downloaded ok."

end if

 從實驗的情況看,ftpte在c/s模式下能很好的支持各項功能,在b/s模式下會找不到組件,可能與沒有注冊有關。

 通過利用ftpte,可能編程實現遠程文件定時或不定時同步等諸多功能,從而實現非手工方式的文件傳輸。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 衡水市| 东山县| 东乡县| 奇台县| 邳州市| 仲巴县| 闽清县| 集安市| 民勤县| 华阴市| 延吉市| 石家庄市| 来凤县| 广德县| 吴堡县| 金寨县| 合川市| 黔西县| 简阳市| 米林县| 琼海市| 沙田区| 深圳市| 浑源县| 江阴市| 靖江市| 海南省| 海盐县| 榆林市| 乌兰浩特市| 长宁县| 哈尔滨市| 桂东县| 岗巴县| 尚志市| 万安县| 鸡泽县| 石首市| 广宗县| 论坛| 山东省|