Ȩ / ȣ / ȣ / ȣ / Fo r m M a i l ( F i l e ÷α )
FrontPage Server Extensisons ?       ODBC ȳ       DB Ӿȳ       Access DB SQL DB ȯ      
Ƽ̵        ε / ٿε        Խ
α׷ ī ϱ       FormMail ȳ       FormMail (File ÷αɻ)  
ü帧
ε ü (sitegalaxy)
sendmail.asp request
÷
cdonts ü 𵨿 newmail ü ̿ؼ ޼
÷
ǻ
÷ν bodyformat Ӽ mailformat Ӽ html ؾ մϴ.
attachfile ޼ҵ ڵ base64 ؾ մϴ.
<%
if attach_count = 1 then
.attachfile strfile,, cdoencodingbase64 ' ÷
if html <> 1 then ' ÷ν bodyformat Ӽ mailformat Ӽ html ؾ .
bodyformat = cdobodyformathtml
mailformat = cdomailformathtml
end if
end if%>
sendmail_ok.asp ִ 丮 upfiles ̶ ϳ ξ մϴ.
ҽڵ κ
<%@ language=vbscript %>
<%
const cdobodyformathtml = 0 'cdo
const cdobodyformattext = 1
const cdomailformatmime = 0
const cdomailformattext = 1
const cdoencodinguuencode = 0
const cdoencodingbase64 = 1
set uploadform = server.createobject("sitegalaxyupload.form") 'ε ü .
fromaddr = trim(uploadform("fromaddr")) ' request .
toaddr = trim(uploadform("toaddr"))
subject = uploadform("subject")
html = uploadform("html")
if html = "on" then 'html
html = 1
else
html = 0
end if
body = uploadform("body")
attach_file = uploadform("file")
attach_file = trim(attach_file)
if (attach_file = "") then '÷ Ȯ
attach_count = 0
else
attach_count = 1
end if
if attach_count = 1 then '÷ ó
filename = mid(attach_file, instrrev(attach_file, "\") + 1) '̸ ̾Ƴ
strfile = server.mappath(".")& "\upfiles\" '
strfile = strfile & filename
size=uploadform("file").size '÷ size
if formatnumber(size/1024) > 5120 then '÷ size 5mb ̻϶
%>
<script language=javascript>
<!--
alert("÷ 5mb ϴ.");
history.back();
//-->
</script>
<%
response.end
else '÷
uploadform("file").saveas strfile
end if
end if
set uploadform = nothing 'ε ü Ҹ
set objmail = server.createobject("cdonts.newmail") 'newmail ü
with objmail
. from = fromaddr ' ּ
.to = toaddr '޴ ּ
.subject = subject '
.body = body '
if html = 1 then 'html
.bodyformat = cdobodyformathtml
.mailformat = cdomailformathtml
end if
if attach_count = 1 then
.attachfile strfile,,cdoencodingbase64 ' ÷
if html <> 1 then ' ÷ν bodyformat Ӽ mailformat Ӽ html ؾ
.bodyformat = cdobodyformathtml
.mailformat = cdomailformathtml
end if
end if
.send '
end with
set objmail = nothing 'newmail ü Ҹ
if attach_count = 1 then
set objfso = server.createobject("scripting.filesystemobject") ' ý ü
if objfso.fileexists(strfile) then '
objfso.deletefile(strfile) '
end if
set objfso = nothing 'ü Ҹ
end if
%>
<script language="javascript">
<!--
alert(" ߽ϴ.");
self.close();
//-->
</script>
ҽڵ

filename = mid(attach_file,instrrev(attach_file, "\") + 1)
strfile = server.mappath(".")& "\upfiles\"
strfile = strfile & filename

κп ϴ ۾ ٷ ۵ ̸ κԴϴ.
̸ ؼ ⿡ mid Լ instrrev Լ ̿Ͽϴ.
attach_file ÷ ü ΰ Ǿ ֽϴ.
ο ̸ ̱ ؼ 켱 instrrev Լ ؼ ü ο (\) Ÿ ġ ãϴ.
  * instrrev - Լ
instrrev Լ ˻ ڿ κ ˻ ġ ȯմϴ.
,
dim searchstring = "nunauri.com" '˻ ڿԴϴ.
pos = instrrev(searchstring, "w") '9 ȯմϴ.
instrrev Լ Ͽ ü ο ڿ (\) ġ ȯϰ ִ Դϴ.
ġ ̿Ͽ mid Լ ڿ Ǿ ̰ ٷ ϸ Ǵ Դϴ.
׸, mappath method Ͽ θ ϴ.
if formatnumber(size/1024) > 5120 then
%>
<script language=javascript>
<!--
alert("÷ 5mb ϴ.");
history.back();
//-->
</script>
κ formatnumber Լ ̿Ͽ ÷ ũⰡ 5mb ̻ â ִ κԴϴ.
  * formatnumber - Լ
formatnumber Լ ڷ ȭ ȯմϴ.
,
num = 100.25
result = formatnumber(num/10, 2) '10.03 ȯ
ֵ ι° ڸ 2 ϸ Ҽ ڸ ȯ, 3 ϸ ڸ ȯմϴ.
with objmail
.from = fromaddr
.to = toaddr
.subject = subject
.body = body
.send
end with
with ؼ ϴ κԴϴ.
with ϸ ü ̸(⼱ objmail) ٽ ο ʰ ü Ϸ ֽϴ.
, ü ٸ Ӽ Ϸ with Ӽ Ҵ繮 Ӵϴ. ( ó)
̷ ϸ ü Ӽ ϴ ü ϸ ˴ϴ.
if attach_count = 1 then
set objfso = server.createobject("scripting.filesystemobject")
if objfso.fileexists(strfile) then
objfso.deletefile(strfile)
end if
set objfso = nothing
end if
÷ ϱ ý ü ؼ ϸ ϴ κԴϴ.
ϱ deletefile method ߽ϴ.
  Ȩ ȸҰ óħ ̿