asp
Binary 데이타를 받아서 server에 화일로 저장시키는
duraboys
2007. 5. 3. 00:25
Dim FileSavePath ,ext, filename
FileSavePath = Server.MapPath(".")
ext = Mid(attFile, InstrRev(attFile, ".")+1) '화일 확장자 추출
filename = "sample."& ext
intByteCnt = Request.TotalBytes '데이터 블록의 총바이트 값이 들어감
strData = Request.BinaryRead(intByteCnt) '바이너리 스트림 데이타
If intByteCnt > 1 Then
'----------------------------------------------
' Binary 데이타를 받아서 server에 화일로 저장시킴.
'----------------------------------------------
Set objStream = CreateObject("ADODB.Stream")
objStream.Open()
objStream.Type = 1 ' 1: binary 타입을 의미한다.
objStream.Write strData
objStream.SaveToFile FileSavePath &"\"& filename, 2 '2:덮어쓰기 허용
Set objStream = nothing
End if
' 단, body에 바이너리 화일만 와야 함.