<% if Len(Session("id"))= 0 then Response.redirect "default.asp" end if %> <% Sub BuildUploadRequest(RequestBin) PosBeg = 1 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) if PosEnd = 0 then Response.Write "Form was submitted with no ENCTYPE=""multipart/form-data""
" Response.Write "Formda hata var lütfen tekrar deneyiniz / Please correct the form attributes and try again." Response.End end if boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg) boundaryPos = InstrB(1,RequestBin,boundary) Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--"))) Dim UploadControl Set UploadControl = CreateObject("Scripting.Dictionary") Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition")) Pos = InstrB(Pos,RequestBin,getByteString("name=")) PosBeg = Pos+6 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34))) Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename=")) PosBound = InstrB(PosEnd,RequestBin,boundary) If PosFile<>0 AND (PosFile "") Then if UploadQueryString <> "" then uploadAction = uploadAction & "&" & UploadQueryString end if End If If (CStr(Request.QueryString("upload")) <> "") Then redirectPage = "uploadsuccess.asp" If (redirectPage = "") Then redirectPage = CStr(Request.ServerVariables("URL")) end if RequestBin = Request.BinaryRead(Request.TotalBytes) Dim UploadRequest Set UploadRequest = CreateObject("Scripting.Dictionary") BuildUploadRequest RequestBin keys = UploadRequest.Keys for i = 0 to UploadRequest.Count - 1 curKey = keys(i) if UploadRequest.Item(curKey).Item("FileName") <> "" then value = UploadRequest.Item(curKey).Item("Value") valueBeg = UploadRequest.Item(curKey).Item("ValueBeg") valueLen = UploadRequest.Item(curKey).Item("ValueLen") if valueLen = 0 then Response.Write "Dosya yüklemede HATA!/ An error has occured saving uploaded file!

" Response.Write "Dosya İsmi / File name: " & Trim(curPath) & UploadRequest.Item(curKey).Item("FileName") & "
" Response.Write "Dosya bulunamadı / Maybe the destination directory does not exist, or you don't have write permission.
" Response.Write "Lütfen hatalrınızı düzeltin ve / Please correct andtekrar deneyiniz / try again." response.End end if Dim strm1, strm2 Set strm1 = Server.CreateObject("ADODB.Stream") Set strm2 = Server.CreateObject("ADODB.Stream") strm1.Open strm1.Type = 1 'Binary strm2.Open strm2.Type = 1 'Binary strm1.Write RequestBin strm1.Position = ValueBeg strm1.CopyTo strm2,ValueLen curPath = Request.ServerVariables("PATH_INFO") curPath = Trim(Mid(curPath,1,InStrRev(curPath,"/")) & "images") if Mid(curPath,Len(curPath),1) <> "/" then curPath = curPath & "/" end if DosyaAdi= IsimUret()& Right(UploadRequest.Item(curKey).Item("FileName"),4) on error resume next strm2.SaveToFile Trim(Server.mappath("../resimler"))& "\" & DosyaAdi,2 if err then Response.Write "Dosya yüklemede hata ! / An error has occured saving uploaded file!

" Response.Write "Dosya İsmi: / File name : " & Trim(curPath) & UploadRequest.Item(curKey).Item("FileName") & "
" Response.Write "Dosya bulunamadı / File does not exists or is empty.
" Response.Write "Lütfen hatalarınızı düzeltin ve / Please correct and tekrar deneyiniz/try again." err.clear response.End end if end if next If (redirectPage <> "") Then If (InStr(1, redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then redirectPage = redirectPage & "?" & UploadQueryString End If Call Response.Redirect("kategoriler.asp?resimyolu=" & DosyaAdi) end if end if if UploadQueryString <> "" then UploadQueryString = UploadQueryString & "&upload=true" else UploadQueryString = "upload=true" end if %> |: Dosya Yükleme / Upload Image:|






 Dosya Yükleme