請問如何通過ASP將EXCEL文件上傳到服務器并且同時上傳到另外一台服務器?(詳細說明見文)
各位尊敬的大蝦﹕
本人在萬分憔悴的狀況下向各位提問﹐懇請指教。我要在客戶端通過ASP網頁上傳到服務器A(注意﹕A不是ASP代碼所在的服務器﹐ASP代碼所在的服務器是B)應該怎么做???
本人的做法是﹕
在A共享一個文件夾﹐然后將這個文件夾做成網絡磁盤映射在B的H盤。如果將文件放入H盤就相當于將文件放入A的共享文件夾里面。然后相應的上傳的ASP代碼如下﹕
set f=server.CreateObject("aspsmartupload.smartupload")
f.Upload
If not f.Files.Item(1).ismissing Then
excel_file=f.Files.item(1).filename
'********獲得文件後綴****************
fileext=getfileextname(excel_file)
'************判斷是否是.xls***************
if fileext<>"xls" then
Response.Write ("<font color=red>It must be a XLS file</font>")
Response.End
end if
tempfile=datesplit()
'*****************存儲xls文件到服務器上******************* f.Files.Item(1).saveas "h:\"&tempfile& ".xls"
end if
function datesplit()
datesplit=year(now())&month(now())&day(now())&hour(now())&minute(now())&second(now())
end function
function getfileextname(filename)
dim dos
pos=instrrev(filename,".")
if pos>0 then
getfileextname=mid(filename,pos+1)
else
getfileextname=""
end if
end function
重點語句是f.Files.Item(1).saveas "h:\"&tempfile& ".xls"
請各位大蝦略顯神功﹐在下將不勝感激