shiko adlı üyeden alıntı: mesajı görüntüle
<%@LANGUAGE="VBSCRIPT"%> 
<%
Sub BuildUploadRequest(RequestBin)
	PosBeg = 1
  	PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
	if PosEnd = 0 then
Response.Write "<b>Resim eklendi No ENCTYPE=""multipart/form-data""</b><br>"
Response.Write "Tekrar Deneyin."
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<PosBound) Then
PosBeg = PosFile + 10
PosEnd =  InstrB(PosBeg,RequestBin,getByteString(chr(34)))
      	FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
      	FileName = Mid(FileName,InStrRev(FileName,"\")+1)
      	UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
      	ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
      	UploadControl.Add "ContentType",ContentType
PosBeg = PosEnd+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = FileName
      	ValueBeg = PosBeg-1
      	ValueLen = PosEnd-Posbeg
Else
Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
ValueBeg = 0
ValueEnd = 0
End If
    	UploadControl.Add "Value" , Value	
    	UploadControl.Add "ValueBeg" , ValueBeg
    	UploadControl.Add "ValueLen" , ValueLen	
    	UploadRequest.Add name, UploadControl	
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
Function getByteString(StringStr)
For i = 1 to Len(StringStr)
 	  char = Mid(StringStr,i,1)
	  getByteString = getByteString & chrB(AscB(char))
Next
End Function
Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
	  getString = getString & chr(AscB(MidB(StringBin,intCount,1))) 
Next
End Function
Function UploadFormRequest(name)
on error resume next
if UploadRequest.Item(name) then
UploadFormRequest = UploadRequest.Item(name).Item("Value")
end if  
End Function
	UploadQueryString = Replace(Request.QueryString,"GP_upload=true","")
	if mid(UploadQueryString,1,1) = "&" then
	UploadQueryString = Mid(UploadQueryString,2)
end if
GP_uploadAction = CStr(Request.ServerVariables("URL")) & "?GP_upload=true"
If (Request.QueryString <> "") Then  
if UploadQueryString <> "" then
	  GP_uploadAction = GP_uploadAction & "&" & UploadQueryString
end if 
End If
If (CStr(Request.QueryString("GP_upload")) <> "") Then
GP_redirectPage = "resim.asp"
If (GP_redirectPage = "") Then
GP_redirectPage = CStr(Request.ServerVariables("URL"))
end if
  	RequestBin = Request.BinaryRead(Request.TotalBytes)
  	Dim UploadRequest
  	Set UploadRequest = CreateObject("Scripting.Dictionary")  
  	BuildUploadRequest RequestBin
GP_keys = UploadRequest.Keys
for GP_i = 0 to UploadRequest.Count - 1
GP_curKey = GP_keys(GP_i)
if UploadRequest.Item(GP_curKey).Item("FileName") <> "" then
GP_value = UploadRequest.Item(GP_curKey).Item("Value")
GP_valueBeg = UploadRequest.Item(GP_curKey).Item("ValueBeg")
GP_valueLen = UploadRequest.Item(GP_curKey).Item("ValueLen")
if GP_valueLen = 0 then
        	Response.Write "<B>Hata Oluştu!</B><br><br>"
        	Response.Write "Dosya Adı: " & Trim(GP_curPath) & UploadRequest.Item(GP_curKey).Item("FileName") & "<br>"
        	Response.Write "Dosya Bulunamadı<br>"
        	Response.Write "Düzeltip  <A HREF=""javascript:history.back(1)"">Tekrar Deneyin</a>"
	  	  response.End
	    end if
      Dim GP_strm1, GP_strm2
      Set GP_strm1 = Server.CreateObject("ADODB.Stream")
      Set GP_strm2 = Server.CreateObject("ADODB.Stream")
      GP_strm1.Open
      GP_strm1.Type = 1 'Binary
      GP_strm2.Open
      GP_strm2.Type = 1 'Binary
      GP_strm1.Write RequestBin
      GP_strm1.Position = GP_ValueBeg
      GP_strm1.CopyTo GP_strm2,GP_ValueLen
      GP_curPath = Request.ServerVariables("PATH_INFO")
      GP_curPath = Trim(Mid(GP_curPath,1,InStrRev(GP_curPath,"..")) & "../resimler")
      if Mid(GP_curPath,Len(GP_curPath),1) <> "/" then
      GP_curPath = GP_curPath & "/"
      end if  
      on error resume next
      GP_strm2.SaveToFile Trim(Server.mappath(GP_curPath))& "\" & UploadRequest.Item(GP_curKey).Item("FileName"),2
      if err then
        	Response.Write "<B>Hata Oluştu</B><br><br>"
        	Response.Write "Dosya Adı: " & Trim(GP_curPath) & UploadRequest.Item(GP_curKey).Item("FileName") & "<br>"
        	Response.Write "Resim yollamaya izniniz yok<br>"
        	Response.Write "Düzeltip <A HREF=""javascript:history.back(1)"">Tekrar >Deneyin</a>"
  		  err.clear
	  	  response.End
	    end if
    end if
    next
If (GP_redirectPage <> "") Then
If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
End If
Call Response.Redirect(GP_redirectPage)  
end if  
end if  
if UploadQueryString <> "" then
UploadQueryString = UploadQueryString & "&GP_upload=true"
else  
UploadQueryString = "GP_upload=true"
end if  
%>
<html>
<body topmargin="0" leftmargin="0">
<script language="JavaScript">
<!--
function getFileExtension(filePath) { //v1.0
  fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
  return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}
function checkFileUpload(form,extensions) { //v1.0
  document.MM_returnValue = true;
  if (extensions && extensions != '') {
    for (var i = 0; i<form.elements.length; i++) {
      field = form.elements[i];
      if (field.type.toUpperCase() != 'FILE') continue;
      if (field.value == '') {
        alert('Resim Gönderiliyor!  Yenionline Shop teşşekür eder.');
        document.MM_returnValue = false;field.focus();break;
      }
      if (extensions.toUpperCase().indexOf(getFileExtension(field.value).toUpperCase()) == -1) {
        alert('Bu dosya uzantısı izinli değil!');
        document.MM_returnValue = false;field.focus();break;
  } } }
}
//-->
</script>
</head>
<body text="#000000">
<br>
<center>
<form method="POST" action="<%=GP_uploadAction%>" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG');checkFileUpload(this,'');return document.MM_returnValue">
<input type="file" name="file" size="20">
<input type="submit" name="Submit" value="Gönder">
</center>
</form>
<b><center><button class="input_1" onclick="window.close()"><b>Pencereyi kapat</b></button></b>
</body>
</html>
bu işinizi görür
kullanımı hakkında biraz bilgi verirmisiniz