function makeattach(fileContentType,filevalue,i) select case fileContentType case "application/msword" ext="doc"
case "application/vnd.ms-excel" ext="exl"
case "application/vnd.ms-powerpoint" ext="pps"
case "application/x-rar-compressed" ext="rar"
case "application/x-zip-compressed" ext="zip"
case "image/gif" ext="gif"
case "image/pjpeg" ext="jpg"
case "text/plain" ext="txt"
case else ext="x"
end select if ext<>"x" then set fso=server.createobject("FileSystemObject") fName="attech"&i&"."&ext Dir="d:attach" If fso.FileExists(Dir & fName) Then fso.deletefile Dir & fName If fName<>"" AND NOT fso.FileExists(Dir & fName) Then Set strm1=Server.CreateObject("ADODB.Stream") strm1.Open strm1.Type=1 'Binary strm1.Write filevalue strm1.SaveToFile Dir & fName,2 Set strm1=Nothing end if makeattach=fName end if end function