Dim fso 'ファイルオブジェクト
Dim fl 'ファイル
Dim flsize 'ファイルせず
Dim objStream 'Streamオブジェクト
Dim ContentType 'ファイルタイプ
Dim flName 'ファイル名称
'ファイルパスの獲得に失敗しました。
If Err.Number <> 0 Then
Call Msg_Output("ERR0102","","","","")
End If
Set fso=Server.CreateObject("Scripting.FileSystemObject")
'ファイルオブジェクトの新規作成に失敗しました。
If Err.Number <> 0 Then
Set fso = Nothing
Call Msg_Output("ERR0100","","","","")
End If
Set fl=fso.getfile(strURL)
'ファイルの獲得に失敗しました。
If Err.Number <> 0 Then
Set fso = Nothing
Call Msg_Output("ERR0108","","","","")
End If
flsize=fl.size
flName=fl.name
Set fso=Nothing
Set objStream = Server.CreateObject("ADODB.Stream")
'ストリーム オブジェクトの新規作成に失敗しました。
If Err.Number <> 0 Then
Set objStream = Nothing
Call Msg_Output("ERR0109","","","","")
End If
objStream.Open
'ストリームの開くに失敗しました。
If Err.Number <> 0 Then
Set objStream = Nothing
Call Msg_Output("ERR0110","","","","")
End If
objStream.Type = 1
objStream.LoadFromFile strURL
'ファイルのロードに失敗しました。
If Err.Number <> 0 Then
Set objStream = Nothing
Call Msg_Output("ERR0111","","","","")
End If
Select Case lcase(Right(flName, 4))
Case ".doc"
ContentType = "application/msword"
Case ".csv"
ContentType = "text/plain"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".htm", "html"
ContentType = "text/html"
Case ".txt"
ContentType = "text/plain"
Case Else
ContentType = "application/octet-stream"
End Select