Alıntı
<%
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>
<title>Resim Ekle</title>
<meta content="Microsoft FrontPage 6.0" name="GENERATOR">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Language" content="tr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
</head>
<body link="#000000" vlink="#000000" alink="#000000">
<p align="center"><b>&nbsp; <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="imageupload" 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="imageupload.Submit.disabled=true; imageupload.Submit.value='Please Wait...'; imageupload.submit()">
</font></p>
</form>
<hr>
<font face="Verdana" size="2"></p>
<p align="center">

<b>
<a style="text-decoration: none" href="JavaScriptnClick=%20window.close()">[
KAPAT ]</a></b></p>
<%
Sub ImageUpload
GercekKlasor = "imgs"
ImageDir = "imgs"
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 "ResimEkle.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="JavaScriptnClick=%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.imageupload.<%=Kac%>.focus( );
window.opener.document.imageupload.<%=Kac%>.value += '<%=Session("KarisikYazi")%><%=FileName%>';
window.close();
</script>
<%
End IF
Response.End
End Sub
%> </p>
</body>
</html>
yukarda ki kodu resimekle.asp diye kaydet. Daha sonra formmailinin <form method alanına şu kodları ekle language="javascript" name="imageupload" ve daha sonra resimin otomatik ekleneceği input'un name ismini resim yap ve yanına şu kodu ekle
Alıntı
<a href="javascript:void%20window.open('ResimEkle.asp ?Kac=resim','','top=20,left=20,width=450,height=25 0,toolbar=no,scrollbars=No')">
<span style="text-decoration: none">Resim Ekle</span></a>
Eğer yapamazsan msn adresimi ekle ordan yardımcı olurum sana oke.