SmartUpload

一、本元件主要語法說明

'建立並準備使用上傳檔案元件

Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload ")

'允許上傳檔之副檔名及檔案格式限制,此例我設定成只能傳gif等圖檔

mySmartUpload.AllowedFilesList = "gif,GIF,jpg,JPG "

'上傳檔之檔案大小上限,此例我設定10k

mySmartUpload.MaxFileSize = 10000

'上傳檔之檔案大小總合之上限,此例我設定100k

mySmartUpload.TotalMaxFileSize = 100000

'開始上傳

mySmartUpload.Upload

'對每個檔案分別動作

For each file In mySmartUpload.Files

'存檔動作,目錄路徑要設定你自己的網站位址下的目錄,此例為您的主網頁目錄下的upload目錄

file.SaveAs(Server.MapPath(". ") & "/upload/ " & file.FileName)

'檔案表單欄位、檔案大小、檔名、副檔名、路徑、等等

file.Name、file.Size、file.FileName、file.FileExt、file.FilePathName、.....

'所有上傳檔案大小總計

mySmartUpload.Files.TotalBytes

'取得上傳表格中之其他欄位內容,此例為取得表格中「您的大名」之內容。

mySmartUpload.Form("myname ")

'結束SmartUpload作業

set mySmartUpload=nothing

二、錯誤代碼一覽及說明

Objet SMARTUPLOAD
1005Index is out of range.檔案的索引值超出範圍
1010The extension of the file is not allowed to be uploaded.檔案型態不符合設定
1015The extension of the file is denied to be uploaded.檔案型態不符合設定
1020Unable to save file from the DataBase.無法從資料庫將檔案儲存
1025There is no specified destination file.目的檔案不存在
1030The Form cannot be saved in the specified file.
1035Physical path is denied.無法存取檔案路徑
1040File not found.檔案不存在
Objet FILE
1105The maximum size by file is exceeded.上傳檔案大小超過上限
1110The maximum size of files is exceeded.所有上傳檔案大小總合超過上限
1115Index is out of range.檔案的索引值超出範圍
1120File can't be saved.無法儲存檔案
1125Physical path is denied.無法存取檔案路徑
1130Unable to save file in the DataBase.無法將檔案存到資料庫
1135Directory's name is invalid or does not exist.檔案路徑不存在
1140There is no specified destination file.目的檔案不存在
Collection FILES
1205Files' name is invalid or does not exist.檔案名稱錯誤
Collection FORM
1305Form's index is invalid or does not exist.表單變數的索引值超出範圍