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
<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ı :)