01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & aspSmartUpload</title>
05.
</head>
06.
<body>
07.
08.
<%
09.
Dim
mySmartUpload,file,a
10.
a=
"txt,pdf"
11.
12.
Set
mySmartUpload = Server.CreateObject(
"aspSmartUpload.SmartUpload"
)
13.
mySmartUpload.AllowedFilesList=a
14.
15.
16.
mySmartUpload.Upload
17.
18.
If
mySmartUpload.Files=a
Then
19.
20.
21.
If
mySmartUpload.Files(
"file1"
).FileName <>
""
Then
22.
mySmartUpload.Files(
"file1"
).SaveAs(Server.MapPath(
"uploads/"
& mySmartUpload.Files(
"file1"
).FileName))
23.
Response.write mySmartUpload.Files(
"file1"
).Name &
" Uploaded."
24.
End
If
25.
Else
26.
response.write(
"<script>alert('อัพไฟล์ให้ถูกหน่อยสิโว้ย');window.location.history.back();</script>"
)
27.
End
if
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
Set
mySmartUpload =
Nothing
41.
42.
%>
43.
</body>
44.
</html>