Dim imgFileName(), imgMaxFileSize
Redim imgFileName(UploadRequest.Count)
imgMaxFileSize = 1000 * 1024
for AF_i = 0 to UploadRequest.Count - 1
AF_curKey = AF_keys(AF_i)
if UploadRequest.Item(AF_curKey).Item("FileName") <> "" then
AF_valueLen = UploadRequest.Item(AF_curKey).Item("ValueLen")
select case LCase(Right(UploadRequest.Item(AF_curKey).Item("FileName"), 3))
case "gif", "jpg", "png"
'Warning if file size is 0 byte
if AF_valueLen = 0 then
Response.Write "<B>An error has occured saving uploaded file!</B><br><br>"
Response.Write "Filename: " & Trim(AF_curPath) & UploadRequest.Item(AF_curKey).Item("FileName") & "<br>"
Response.Write "File does not exists or is empty.<br>"
Response.Write "Please correct and <A HREF=""javascript:history.back(1)"">try again</a>"
Response.End
'Response.Redirect("../error_nopic.asp")
end if
'Warning if file size is more than max one
if AF_valueLen > imgMaxFileSize then
Response.Write "<B>An error has occured saving uploaded file!</B><br><br>"
Response.Write "Filename: " & Trim(AF_curPath) & UploadRequest.Item(AF_curKey).Item("FileName") & "<br>"
Response.Write "File size (" & FormatNumber(AF_valueLen,0) & " Bytes) is more than max file size (" & FormatNumber(imgMaxFileSize,0) & " Bytes).<br>"
Response.Write "Please correct and <A HREF=""javascript:history.back(1)"">try again</a>"
Response.End
'Response.Redirect("../error_piclimit.asp")
end if
case else
Response.Write "<B>An error has occured saving uploaded file!</B><br><br>"
Response.Write "Filename: " & Trim(AF_curPath) & UploadRequest.Item(AF_curKey).Item("FileName") & "<br>"
Response.Write "File extensions should only be ""gif, jpg, png"".<br>"
Response.Write "Please correct and <A HREF=""javascript:history.back(1)"">try again</a>"
Response.End
'Response.Redirect("../error_pictype.asp")
end select
end if
next
'-------------------------------------------------------------------
for AF_i = 0 to UploadRequest.Count - 1
AF_curKey = AF_keys(AF_i)
'Save all uploaded files
if UploadRequest.Item(AF_curKey).Item("FileName") <> "" then
AF_value = UploadRequest.Item(AF_curKey).Item("Value")
AF_valueBeg = UploadRequest.Item(AF_curKey).Item("ValueBeg")
AF_valueLen = UploadRequest.Item(AF_curKey).Item("ValueLen")
'Create a Stream instance
Dim AF_strm1, AF_strm2
Set AF_strm1 = Server.CreateObject("ADODB.Stream")
Set AF_strm2 = Server.CreateObject("ADODB.Stream")
'Create and Write to a File
AF_curPath = Request.ServerVariables("PATH_INFO")
AF_curPath = Trim(Mid(AF_curPath,1,InStrRev(AF_curPath,"/")) & "")
if Mid(AF_curPath,Len(AF_curPath),1) <> "/" then
AF_curPath = AF_curPath & "/"
end if
'-------------------------------------------------------------------
if Near_Name <> session("Near_Name") and Img1 <> session("Img1") then
adminprorect=False
adminalldata=2
else
adminprorect=True
adminalldata=1
end if
if adminprorect <> true and Near_Name <>"" and Img1 <>"" then
strsql="Select * From Near_Station WHERE Near_Name='"&Near_Name&"'"' and Abbot_Pic='"Abbot_Pic&"'"
Set rs1=strcon.execute(strsql)
if not rs1.eof then
adminallmember=1
else
adminallmember=0
end if
rs1.close
Set rs1=Nothing
if adminallmember=0 then
Set rs=Server.CreateObject("ADODB.Recordset")
strsql="Select * From Near_Station order by Near_ID"
rs.open strsql,strcon,1,3
rs.Addnew