% 'fkodu=Session("fkodu") %>
<% if fkodu<>"" then %>|
<%
Yol = "firmalar/"&fkodu&"/logo"
izinli = 500000 'Maximum dosya boyut 2500 kb
%>
<%
Dim sifrele
Randomize
sifrele =int (rnd*9999999)+1
randomcode= ""&sifrele&""
If Request.QueryString("action")="yukle" Then
Call Yukle
Response.End
Else
End if
Sub Yukle
Dim ImageDir
ImageDir = Yol
ForWriting = 2
adLongVarChar = 201
lngNumberUploaded = 0
noBytes = Request.TotalBytes
binData = Request.BinaryRead (noBytes)
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
strData = Mid(strDataWhole, lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)
strDataWhole = Replace(strDataWhole, strData,"")
lngBeginFileName = InStr(1, strdata, "filename=") + 10
lngEndFileName = InStr(lngBeginFileName, strData, Chr(34))
If lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then
Response.Write "Yüklenecek Bir Resim Şecmelisiniz... "%> <%Response.End End If 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) If session("yukledi") = FileName Then Response.Write "Aynı Dosya'yı sadece 1 kez yükleyebilirsiniz.. " %> <%Response.End Else session("yukledi")=""&FileName&"" End if uzanti = Right(FileName,3) If uzanti="asp" or uzanti="mdb" or uzanti="zip" or uzanti="rar" or uzanti="exe" or uzanti="EXE" or uzanti="RAR" or uzanti="php" or uzanti="htm" or uzanti="html" or uzanti="ASP" or uzanti="MDB" or uzanti="PHP" or uzanti="HTM" or uzanti="HTML" then Response.Write "Bu tür resim yüklenemez. Sadece .gif .jpg .png uzantılı resimler yükleyebilirsiniz.. " %> <%Response.End Else FileName = randomcode + "." & uzanti &"" 'dosya adını değiştirir End If lngDataLenth = lngEndPos - lngBeginPos boyut = lngDataLenth If boyut > izinli then Response.Write "Yüklediğiniz Resim Maximum Resim Boyutundan Büyük! Lütfen Daha Küçük Boyutta Bir Resim Deneyin.. " %> <%Response.End Else lngDataLenth = "" & boyut &"" End If Set FSO = CreateObject("Scripting.FileSystemObject") Set Klasor = FSO.GetFolder(Server.MapPath(imagedir)) For Each listele in Klasor.Files If FileName = listele.Name Then Response.Write "Yüklemek istediginiz resim ismi ile aynı isimde bir resim var! Lütfen ismini değiştirerek yeniden yükleyin.. " %> <%Response.End End if Next Set Klasor = Nothing If Right(FileName,4) = ".gif" or Right(FileName,4) = ".jpg" or Right(FileName,4) = ".png" or Right(FileName,4) = ".GIF" or Right(FileName,4) = ".PNG" or Right(FileName,4) = ".JPG" Then Set FSO = Nothing strFileData = Mid(strData, lngBeginPos, lngDataLenth) FileName = kullanici&FileName Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(Server.MapPath(imagedir) & "/" & FileName, ForWriting, True) f.Write strFileData Set f = Nothing Set fso = Nothing Else Response.Write "Bu tür resim yüklenemez. Sadece .gif .jpg .png uzantılı resimler yükleyebilirsiniz.. " %> <%Response.End End if lngNumberUploaded = lngNumberUploaded + 1 End If lngCurrentBegin = InStr(1, strDataWhole, strBoundry) lngCurrentEnd = InStr(lngCurrentBegin + 1, strDataWhole, strBoundry) - 1 Loop %> <%'Logo db ye kayıt ediliyor. sorgum="Select * from firma where fkodu="&fkodu Rx.Open Sorgum, Baglantim, 1, 3 rx("logo")=""&yol&"/"&filename rx.update rx.close %> Logo Basariyla Yüklendi. Logonuzun Kayıt Adı : <%=FileName%> :::... Ana Sayfa ...::: <% FileName = ""&uploadklasor&"/" & FileName End Sub %> Kabul Edilen Resim Türleri: .gif .jpg .png Maximum Resim Boyutu: <%=left(izinli,4)%> kb |