Şimdi Ara

kodlarını verdiğim şu resim ekleme sayfası için Kilobayt Sınırını nasıl Kaldırırız

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
5
Cevap
0
Favori
934
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Arkadaşlar bir tane hazır resim ekleme sayfası var bu sayfada resim ekleme yaparken kilobayt olarak büyük olan mesela 200kb dan büyüğünü yüklerken bazen zorlanıyor bazende hiç atmıyor hele daha da üstü ise hiç atmıyor bu sayfadaki kilobayt ayarını nasıl sınırsız yaparız bilginiz varmıdır




    Kodlar Şöyle :







    <%
    Session.TimeOut = 1400
    Response.Expires = -1
    Response.ExpiresAbsolute = Now() - 1
    Response.AddHeader "pragma","no-cache"
    Response.AddHeader "cache-control","private"
    Response.CacheControl = "no-cache"
    %>
    <%
    islem = Request("islem")
    If islem = "Yukle" Then
    call ImageUpload
    End If
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
    </head>
    <body link="#000000" vlink="#000000" alink="#000000">
    <p align="center"><b>
      <font face="Verdana" style=font-size:14pt color="#4D6E93">Resim Yükle</font><br>

    <%
    Function SifreUret(Boy)
    Dim Sifre,KarakterBoyu,KacinciKarakter
    Const Karakterler = "ABCDEFGHIJKLMNOPRSTUVYZXW0123456789"
    Randomize
    KarakterBoyu = Len(Karakterler)
    For x = 1 To Boy
    KacinciKarakter = Int((KarakterBoyu * Rnd) + 1)
    sifre = sifre & Mid(Karakterler,KacinciKarakter,1)
    Next
    SifreUret = sifre
    End Function
    Session("KarisikYazi") = SifreUret(7)
    Kac = request.querystring("Kac")
    %>
    </font></b>
    <form Enctype="multipart/form-data" language="javascript" name="form" Action="?islem=Yukle&Kac=<%=Kac%>" Method="Post">
    <p align="center">
    <font face="Verdana" size="2">Resim Adresi</font><font face="Verdana"><font size="2"> : </font>
    <input NAME="File2" SIZE="38" TYPE="file" style="padding:2px; color: #000000; font-family: Verdana; font-size: 10px; font-weight: bold; border: 1px solid #808080; background-color: #C0C0C0"><font size="2"><br>
    <br>
    </font>
    <input type="submit" value="Yükle" name="Submit" style="padding:2px; color: #000000; font-family: Verdana; font-size: 10px; font-weight: bold; border: 1px solid #808080; background-color: #C0C0C0" onMouseOver="this.style.cursor='hand';" onClick="form.Submit.disabled=true; form.Submit.value='Please Wait...'; form.submit()">
    </font></p>
    </form>
    <hr>
    <font face="Verdana" size="2"></p>
    <p align="center">

    <b>
    <a style="text-decoration: none" href="JavaScript:onClick=%20window.close()">[
    KAPAT ]</a></b></p>
    <%
    Sub ImageUpload
    GercekKlasor = "resimler/"
    ImageDir = "resimler/"
    ForWriting = 2
    adLongVarChar = 201
    lngNumberUploaded = 0
    'Get binary data from form
    noBytes = Request.TotalBytes
    binData = Request.BinaryRead (noBytes)
    'convery the binary data to a string
    Set RST = CreateObject("ADODB.Recordset")
    LenBinary = LenB(binData)
    if LenBinary > 0 Then
    RST.Fields.Append "myBinary", adLongVarChar, LenBinary
    RST.Open
    RST.AddNew
    RST("myBinary").AppendChunk BinData
    RST.Update
    strDataWhole = RST("myBinary")
    End if
    strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE")
    lngBoundryPos = instr(1, strBoundry, "boundary=") + 8
    strBoundry = "--" & right(strBoundry, len(strBoundry) - lngBoundryPos)
    lngCurrentBegin = instr(1, strDataWhole, strBoundry)
    lngCurrentEnd = instr(lngCurrentBegin + 1, strDataWhole, strBoundry) - 1
    Do While lngCurrentEnd > 0
    'Get the data between current boundry and remove it from the whole.
    strData = mid(strDataWhole, lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)
    strDataWhole = replace(strDataWhole, strData,"")
    'Get the full path of the current file.
    lngBeginFileName = instr(1, strdata, "filename=") + 10
    lngEndFileName = instr(lngBeginFileName, strData, chr(34))
    'Make sure they selected a file.
    if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then
    Response.Redirect "Ekle.asp?"
    End if
    'There could be an empty file box.
    if lngBeginFileName <> lngEndFileName Then
    strFilename = mid(strData, lngBeginFileName, lngEndFileName - lngBeginFileName)
    tmpLng = instr(1, strFilename, "\")
    Do While tmpLng > 0
    PrevPos = tmpLng
    tmpLng = instr(PrevPos + 1, strFilename,"\")
    Loop
    FileName = right(strFilename, len(strFileName) - PrevPos)
    lngCT = instr(1,strData, "Content-Type:")
    if lngCT > 0 Then
    lngBeginPos = instr(lngCT, strData, chr(13) & chr(10)) + 4
    Else
    lngBeginPos = lngEndFileName
    End if
    lngEndPos = len(strData)
    'Calculate the file size.
    lngDataLenth = lngEndPos - lngBeginPos
    'Get the file data
    strFileData = mid(strData, lngBeginPos, lngDataLenth)
    IF instr(1,FileName,".asp",1) or instr(1,FileName,".mdb",1) or instr(1,FileName,".htm",1) or instr(1,FileName,".txt",1) or instr(1,FileName,".doc",1) or instr(1,FileName,".psd",1) or instr(1,FileName,".exe",1) or instr(1,FileName,".vbs",1) or instr(1,FileName,".dll",1) or instr(1,FileName,".com",1) or instr(1,FileName,".bat",1) or instr(1,FileName,".rar",1) or instr(1,FileName,".zip",1) or instr(1,FileName,".xls",1) or instr(1,FileName,".html",1) or instr(1,FileName,".php",1) or instr(1,FileName,".cgi",1) or instr(1,FileName,".ocx",1) Then
    %>
    <html>
    <title>Image Upload</title>
    <body link="#000000" vlink="#000000" alink="#000000">
    <center>
    <br><br>
    <b>Göndermeye çalıştığınız dosya türü desteklenmiyor.</b><br>
    <font size="2" color="#FFFFFF" face="Verdana"><br><br><br>
    <br>
    <br>
    <br>
    <br><br>
    <font color="#FFFFFF">
    <b><a style="text-decoration: none" href="JavaScript:onClick=%20window.close()">
    [ KAPAT ]</a></b></font>
    </center>
    <%
    ELSE
    'Create the file.
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile(server.mappath(imagedir) & "/"&Session("KarisikYazi")&"" & FileName, ForWriting, True)
    f.Write strFileData
    Set f = nothing
    Set fso = nothing
    End IF
    lngNumberUploaded = lngNumberUploaded + 1
    End if
    lngCurrentBegin = instr(1, strDataWhole, strBoundry)
    lngCurrentEnd = instr(lngCurrentBegin + 1, strDataWhole, strBoundry) - 1
    loop
    IF instr(1,FileName,".asp",1) or instr(1,FileName,".mdb",1) or instr(1,FileName,".htm",1) or instr(1,FileName,".txt",1) or instr(1,FileName,".doc",1) or instr(1,FileName,".psd",1) or instr(1,FileName,".exe",1) or instr(1,FileName,".vbs",1) or instr(1,FileName,".dll",1) or instr(1,FileName,".com",1) or instr(1,FileName,".bat",1) or instr(1,FileName,".rar",1) or instr(1,FileName,".zip",1) or instr(1,FileName,".xls",1) or instr(1,FileName,".html",1) or instr(1,FileName,".php",1) or instr(1,FileName,".cgi",1) or instr(1,FileName,".ocx",1) Then
    ELSE
    %>
    <%Kac = request.querystring("Kac")%>
    <script language="JavaScript">
    window.opener.document.form.<%=Kac%>.focus();
    window.opener.document.form.<%=Kac%>.value += '<%=Session("KarisikYazi")%><%=FileName%>';
    window.close();
    </script>
    <%
    End IF
    Response.End
    End Sub
    %></p>
    </body>
    </html>







  • <configuration>
    <system.web>
    <httpRuntime maxRequestLength="4096" />
    </system.web>
    </configuration>
    maxRequestLength ile biraz oyna istersen
  • Bu kodu hangi araya koymalıyım çalışması için
  • web.config de
    <system.web> </system.web>
    arasına
  • :) 01ada01 şakamısın sen adam asp kodu yazmış sen asp.net uygulaması için web.config dosyasını söylemişsin :)

    arkadaşım bu upload kodu yerine persist.upload kullanırsan asp upload diyede geçer daha rahat ve daha temiz bir kodun olur. Bu component zaten her serverda yüklüdür. Aspnin olmazsa olmazı :)
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.