% resim=guvenlik(request("resim"))%> <% Class FileUpload Private UploadRequest, oProps, iFrmCt Private iKnownFileCount, iKnownFormCount Private oOutFiles Private Sub Class_Initialize iFrmCt = 0 Set oProps = New FO_Properties Set UploadRequest = Server.CreateObject("Scripting.Dictionary") iKnownFileCount = 0 iKnownFormCount = 0 set oOutFiles = Server.CreateObject("Scripting.Dictionary") End Sub Private Sub Class_Terminate set oOutFiles = Nothing Set UploadRequest = Nothing Set oProps = Nothing End Sub Public Property Get Version() Version = "1.0" End Property Public Function GetUploadSettings() Set GetUploadSettings = oProps End Function Public Property Get FormCount FormCount = iKnownFormCount End Property Public Property Get FileCount FileCount = iKnownFileCount End Property Public Property Get TotalFormCount TotalFormCount = iFrmCt End Property Private Function GetFormEncType() Dim sContType, hCutOff sContType = request.servervariables("CONTENT_TYPE") hCutOff = instr(sContType, ";") if hCutOff > 0 then sContType = UCase(Trim(Left(sContType, hCutOff - 1))) else sContType = UCase(Trim(sContType)) end if GetFormEncType = sContType End Function Public Default Sub ProcessUpload Dim RequestBin, oProcess, iTotBytes, key, arr, iKnownProps, oFile Dim fofilecheck, sEncType, sReqMeth iTotBytes = Request.TotalBytes if iTotBytes = 0 then iFrmCt = 0 exit sub end if RequestBin = Request.BinaryRead(iTotBytes) sReqMeth = request.servervariables("REQUEST_METHOD") select case UCase(sReqMeth) case "POST" sEncType = GetFormEncType select case sEncType case "MULTIPART/FORM-DATA" Set oProcess = New FO_Processor oProcess.BuildUploadRequest RequestBin, UploadRequest Set oProcess = Nothing case "APPLICATION/X-WWW-FORM-URLENCODED" Set oProcess = New FO_Processor oProcess.BuildUploadRequest_ASCII oProcess.getString(RequestBin), UploadRequest Set oProcess = Nothing case else end select case "GET" case else end select arr = uploadrequest.keys if not isarray(arr) then iFrmCt = 0 exit sub end if iFrmCt = ubound(arr) for each key in arr if isobject(uploadrequest.item(key)) then iKnownProps = ubound(uploadrequest.item(key).keys) + 1 if iKnownProps = 4 then iKnownFileCount = iKnownFileCount + 1 set fofilecheck = new FO_FileChecker fofilecheck.SetCurrentProperties oProps fofilecheck.FileInput_NamePath = uploadrequest.item(key).item("FileName") fofilecheck.FileInput_ContentType = uploadrequest.item(key).item("ContentType") fofilecheck.FileInput_BinaryText = uploadrequest.item(key).item("Value") fofilecheck.FileInput_FormInputName = uploadrequest.item(key).item("InputName") set oFile = fofilecheck.ValidateVerifyReturnFile() set fofilecheck = nothing oOutFiles.add iKnownFileCount, oFile set oFile = nothing uploadrequest.remove key elseif iKnownProps = 2 then iKnownFormCount = iKnownFormCount + 1 else end if end if next End Sub Public Function File(ByVal blobName) Dim blobs, cilem, subdict, tmpName blobs = oOutFiles.Keys For Each cilem In blobs Set subdict = oOutFiles.Item(cilem) tmpName = subdict.frmInputName If UCase(Trim(tmpName)) = UCase(Trim(blobName)) Then blobName = cilem Exit For End If Next if isobject(oOutFiles.Item(blobName)) then Set File = oOutFiles.Item(blobName) else Set File = Nothing end if End Function Public Function Form(ByVal inputName) if isobject(UploadRequest.Item(inputName)) then Form = UploadRequest.Item(inputName).Item("Value") else Form = "" end if End Function Public Function FormLen(ByVal inputName) if isobject(UploadRequest.Item(inputName)) then FormLen = Len(UploadRequest.Item(inputName).Item("Value")) else FormLen = 0 end if End Function Public Function FormEx(ByVal inputName, ByVal vDefaultValue) dim vTmp if isobject(UploadRequest.Item(inputName)) then vTmp = UploadRequest.Item(inputName).Item("Value") if len(trim(CStr(vTmp))) = 0 then FormEx = vDefaultValue Exit Function end if FormEx = vTmp Exit Function end if FormEx = vDefaultValue End Function Public Function Inputs() if isobject(UploadRequest) then Inputs = UploadRequest.keys else Inputs = "" end if End Function Public Sub ShowUploadForm(ByVal sSubmitPage) Dim tmp, item With Response .Write("
Kabul Edilen Dosya Türleri:
")
tmp = ""
If IsArray(oProps.Extensions) Then
For Each Item In oProps.Extensions
tmp = tmp & "*." & Item & ", "
Next
tmp = left( tmp, Len(tmp) - 2 )
End If
.Write(tmp & "
")
.Write("Max. Dosya boyutu: ~ ")
.Write(Round( oProps.MaximumFileSize / 1024, 1 ) & " k ")
.Write("
Min. Dosya boyutu: ~ ")
.Write(FormatNumber(Round( oProps.MininumFileSize _
/ 1024, 1 ), 1) & " k.