bir sitemde ürünlerime resim ekliyorum.Fakat uzun yıllardır çalışan upload kodu biranda çalışmaz oldu.bileşenlerden mi kaynaklanıyor bilmiyorum.
Resimekle.htm adında bir dosyam var
<html> <head> <title> Resim Yükleme </title> </head> <body> <div align="center"><Form Method="Post" Name="Form" Enctype="multipart/form-data" Action="upload.asp"> <table width="250" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <Input Name="Dosya" type="FILE" id="Dosya" /> <input name="button" type="submit" id="button" value="Yükle" onclick="javascript:this.form.submit();this.disabled=true; return true;" /> </td> </tr> </table> </Form></div> </body> </html>ve buradan upload.asp ile resimi upload ediyordum.
<html>
<body onLoad="tamamla()">
<%
Set Yukle = New DosyaYukleme
' buraya istedigin klasoru yaz.
Yol = Server.MapPath("/urunresim" )&"\"
response.write yol
DosyaIsmi = Yukle.FileName("dosya" )
tamyol = "../dosya/"+sifre1
dosyauzantisi = Right(Yukle.FileName("dosya"),3)
If DosyaIsmi = "" Then
Response.Write ("Yüklenecek dosyayi seçmediniz.")
Response.End
End if
If Request.TotalBytes > 500000 Then
Response.Write (Yukle.FileName("dosya" )) & " dosyasý 50Kb dan büyüktür"
Response.End
End if
If Request.TotalBytes < 500001 Then
Set FSO = Server.CreateObject("Scripting.FileSystemObject" )
Set YeniDosya = FSO.CreateTextFile(Yol & DosyaIsmi)
For i = 1 To LenB(Yukle.Value("dosya"))
YeniDosya.Write Chr(AscB(MidB(Yukle.Value("dosya"), i, 1)))
Next
YeniDosya.Close
Set YeniDosya = Nothing
Set FSO = Nothing
Set Yukle = Nothing
End If
%>
<body>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">YÜKLEME TAMAMLANDI</font>
<%
' burada yuklenen dosyanýn adýný database e kayýt edebilirsin.
%>
<%
Class DosyaYukleme
Private pvObjUploadRequest
Private Sub Class_Initialize
Dim RequestBin, Boundary, Value
Dim lngPosBegin, lngPosEnd, lngBoundaryPos
Dim lngPos, lngPosFile, lngPosBound
Dim strName, strFileName, strContentType
Dim objUploadControl
Set pvObjUploadRequest = Server.CreateObject("Scripting.Dictionary" )
RequestBin = Request.BinaryRead(Request.TotalBytes)
lngPosBegin = 1
lngPosEnd = InStrB(lngPosBegin, RequestBin, GetByteString(Chr(13)))
Boundary = MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin)
lngBoundaryPos = InstrB(1, RequestBin, Boundary)
Do Until (lngBoundaryPos = InstrB(RequestBin, Boundary & getByteString("--" )))
Set objUploadControl = CreateObject("Scripting.Dictionary" )
lngPos = InstrB(lngBoundaryPos, RequestBin, GetByteString("Content-Disposition" ))
lngPos = InstrB(lngPos, RequestBin, GetByteString("name=" ))
lngPosBegin = lngPos + 6
lngPosEnd = InstrB(lngPosBegin, RequestBin, GetByteString(Chr(34)))
strName = LCase(GetString(MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin)))
lngPosFile = InstrB(lngBoundaryPos, RequestBin, GetByteString("filename=" ))
lngPosBound = InstrB(lngPosEnd, RequestBin, Boundary)
If lngPosFile <> 0 And lngPosFile < lngPosBound Then
lngPosBegin = lngPosFile + 10
lngPosEnd = InStrB(lngPosBegin, RequestBin, GetByteString(Chr(34)))
strFileName = GetString(MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin))
objUploadControl.Add "FileName" , strFileName
lngPos = InStrB(lngPosEnd, RequestBin, GetByteString("Content-Type:" ))
lngPosBegin = lngPos + 14
lngPosEnd = InStrB(lngPosBegin, RequestBin, GetByteString(Chr(13)))
strContentType = GetString(MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin))
objUploadControl.Add "ContentType" , strContentType
lngPosBegin = lngPosEnd + 4
lngPosEnd = InstrB(lngPosBegin, RequestBin, Boundary) - 2
Value = MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin)
Else
lngPos = InstrB(lngPos, RequestBin, GetByteString(Chr(13)))
lngPosBegin = lngPos + 4
lngPosEnd = InStrB(lngPosBegin, RequestBin, Boundary) - 2
Value = GetString(MidB(RequestBin, lngPosBegin, lngPosEnd - lngPosBegin))
End If
objUploadControl.Add "Value" , Value
pvObjUploadRequest.Add strName, objUploadControl
lngBoundaryPos = InStrB(lngBoundaryPos + LenB(Boundary), RequestBin, Boundary)
Loop
End Sub
Private Sub Class_Terminate
Dim objDictionary
For Each objDictionary In pvObjUploadRequest.Items
objDictionary.RemoveAll
Set objDictionary = Nothing
Next
pvObjUploadRequest.RemoveAll
Set pvObjUploadRequest = Nothing
End Sub
Private Function GetByteString(strString)
Dim Char
Dim i
For i = 1 To Len(strString)
Char = Mid(strString, i , 1)
GetByteString = GetByteString & ChrB(AscB(Char))
Next
End Function
Private Function GetString(strBin)
Dim intCount
GetString = ""
For intCount = 1 To LenB(strBin)
GetString = GetString & Chr(AscB(MidB(strBin, intCount, 1)))
Next
End Function
Public Function Value(Name)
Name = LCase(Name)
If pvObjUploadRequest.Exists(Name) Then
Value = pvObjUploadRequest.Item(Name).Item("Value" )
Else
Value = Empty
End If
End Function
Public Function ContentType(Name)
Name = LCase(Name)
If pvObjUploadRequest.Exists(Name) Then
If pvObjUploadRequest.Item(Name).Exists("ContentType" ) Then
ContentType = pvObjUploadRequest.Item(Name).Item("ContentType" )
Else
ContentType = Empty
End If
Else
ContentType = Empty
End If
End Function
Public Function FileNamePath(Name)
Name = LCase(Name)
If pvObjUploadRequest.Exists(Name) Then
If pvObjUploadRequest.Item(Name).Exists("FileName" ) Then
FileNamePath = pvObjUploadRequest.Item(Name).Item("FileName" )
Else
FileNamePath = Empty
End If
Else
FileNamePath = Empty
End If
End Function
Public Function FileName(Name)
Dim strFileName
Name = LCase(Name)
If pvObjUploadRequest.Exists(Name) Then
If pvObjUploadRequest.Item(Name).Exists("FileName" ) Then
strFileName = pvObjUploadRequest.Item(Name).Item("FileName" )
FileName = Right(strFileName, Len(strFileName) - InStrRev(strFileName, "\" ))
Else
FileName = Empty
End If
Else
FileName = Empty
End If
End Function
End Class
%>
<script type="text/javascript">
function tamamla() {
window.opener.document.getElementById('resim').value ="<%=dosyaismi%>";
window.opener.document.getElementById('resimx').src ="http://www.siteismi.com/urunresim/<%=dosyaismi%>";
window.close();
return false;}
</script>
</body>
</html>FAKAT SİSTEM Yüklenecek dosyayi seçmediniz UYARISI VERİYOR.
Lütfen yardımcı olun.çok sıkıntıdayım.