<% IF session("admin")="" then response.write "Bu Sayfaya Erişiminiz Yasaklanmıştır.<br><br>" response.write "Sayfayı Kapatmak İçin <a href=javascript:self.close()><b>Tıklayınız.</b></a>" ELSE Dim ImageDir ImageDir = "files" 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 "default2.asp?sayfa=resimler2" 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
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) 'Create the file. Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(server.mappath(ImageDir) & "/" & FileName, ForWriting, True) f.Write strFileData Set f = nothing Set fso = nothing
Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(server.mappath(ImageDir) & "/sil_"& FileName, ForWriting, True) f.Write strFileData Set f = nothing Set fso = nothing
IF Session("konu_id")<>"" then set rs2 = server.createobject("adodb.recordset") sql="Select id, image from bolum_name_sub_page where id="&Session("konu_id")&"" rs2.open SQL,Sur,1,3 rs2("image")=""&ImageDir&"/konu_"&Session("konu_id")&".jpg" Session("konu_id") = rs2("id") rs2.update rs2.Close Set rs2 = Nothing ELSE set rs2 = server.createobject("adodb.recordset") sql="Select id, uid, image, cat, user, user_id, ip5, name from bolum_name_sub_page" rs2.open SQL,Sur,1,3 rs2.addnew rs2("uid")=1 rs2("cat")=Session("konu_cat_id") rs2("user")=Session("uye") rs2("user_id")=Session("id") rs2("ip5")=Request.ServerVariables("REMOTE_ADDR") rs2("name")="" rs2("image")=""&ImageDir&"/konu_"&rs2("id")&".jpg" Session("konu_id") = rs2("id") rs2.update rs2.Close Set rs2 = Nothing END IF
dim dosyacopy set dosyacopy=CreateObject("Scripting.FileSystemObject") dosyacopy.CopyFile server.mappath(ImageDir) & "/sil_"& FileName &"",server.mappath(ImageDir) & "/konu_"&Session("konu_id")&".jpg",true
set dosyasil=CreateObject("Scripting.FileSystemObject") dosyasil.DeleteFile(""&server.mappath(ImageDir) & "/sil_" & FileName &"") dosyasil.DeleteFile(""&server.mappath(ImageDir) & "/" & FileName &"") set dosyasil=nothing
Response.write ("<center><br><br><br><img src='images/genel/loading2.gif' border='0'><br><br><b>Resim başarılı bir şekilde yüklendi...</b><br><br><br></center>") if Session("bolum_img")=1 then Response.write ("<meta http-equiv=""Refresh"" content=""1;URL=Forum.asp?page=KONU_EKLE&cat_name=&cat_id="&Session("konu_cat_id")&"&id="&Session("konu_id")&""" />") elseif Session("bolum_img")=2 then Response.write ("<meta http-equiv=""Refresh"" content=""1;URL=konu_ekle.asp?cat_id="&Session("konu_cat_id")&"&isle=2&id="&Session("konu_id")&""" />") end if
Hata açıklaması Disk inde yer olmadığı imiş. Tamamen disk dolu olabilir mi?
Ayrıca istersen; "f.Write strFileData" satırından önce aşağıdaki kodu yazarak dosya yolunu kontrol edebilirsin, belki yol hatalıdır: gecicidegisken = server.mappath(ImageDir) & "/sil_"& FileName response.write gecicidegisken response.end
error '80070070'
/Upload_konu_image.asp, line 105 hatası veriyorr veriyor yardım edin arkadaşlar
Upload_konu_image.asp içindekiler bunlar
<% @ Language=VBScript Codepage="1254" %>
<html>
<head>
<title>Resim Upload</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<meta name="content-language" content="tr" />
</head>
<body bgcolor="#FFFFFF">
<!--#include file="config.asp"-->
<!--#include file="Baglan.asp"-->
<%'=Session("konu_page")%>
<%'=Session("konu_cat_id")%>
<%'=Session("konu_id")%>
<%
IF session("admin")="" then
response.write "Bu Sayfaya Erişiminiz Yasaklanmıştır.<br><br>"
response.write "Sayfayı Kapatmak İçin <a href=javascript:self.close()><b>Tıklayınız.</b></a>"
ELSE
Dim ImageDir
ImageDir = "files"
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 "default2.asp?sayfa=resimler2"
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)
'Create the file.
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(server.mappath(ImageDir) & "/" & FileName, ForWriting, True)
f.Write strFileData
Set f = nothing
Set fso = nothing
lngNumberUploaded = lngNumberUploaded + 1
End if
lngCurrentBegin = instr(1, strDataWhole, strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1, strDataWhole, strBoundry) - 1
loop
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(server.mappath(ImageDir) & "/sil_"& FileName, ForWriting, True)
f.Write strFileData
Set f = nothing
Set fso = nothing
IF Session("konu_id")<>"" then
set rs2 = server.createobject("adodb.recordset")
sql="Select id, image from bolum_name_sub_page where id="&Session("konu_id")&""
rs2.open SQL,Sur,1,3
rs2("image")=""&ImageDir&"/konu_"&Session("konu_id")&".jpg"
Session("konu_id") = rs2("id")
rs2.update
rs2.Close
Set rs2 = Nothing
ELSE
set rs2 = server.createobject("adodb.recordset")
sql="Select id, uid, image, cat, user, user_id, ip5, name from bolum_name_sub_page"
rs2.open SQL,Sur,1,3
rs2.addnew
rs2("uid")=1
rs2("cat")=Session("konu_cat_id")
rs2("user")=Session("uye")
rs2("user_id")=Session("id")
rs2("ip5")=Request.ServerVariables("REMOTE_ADDR")
rs2("name")=""
rs2("image")=""&ImageDir&"/konu_"&rs2("id")&".jpg"
Session("konu_id") = rs2("id")
rs2.update
rs2.Close
Set rs2 = Nothing
END IF
dim dosyacopy
set dosyacopy=CreateObject("Scripting.FileSystemObject")
dosyacopy.CopyFile server.mappath(ImageDir) & "/sil_"& FileName &"",server.mappath(ImageDir) & "/konu_"&Session("konu_id")&".jpg",true
set dosyasil=CreateObject("Scripting.FileSystemObject")
dosyasil.DeleteFile(""&server.mappath(ImageDir) & "/sil_" & FileName &"")
dosyasil.DeleteFile(""&server.mappath(ImageDir) & "/" & FileName &"")
set dosyasil=nothing
Response.write ("<center><br><br><br><img src='images/genel/loading2.gif' border='0'><br><br><b>Resim başarılı bir şekilde yüklendi...</b><br><br><br></center>")
if Session("bolum_img")=1 then
Response.write ("<meta http-equiv=""Refresh"" content=""1;URL=Forum.asp?page=KONU_EKLE&cat_name=&cat_id="&Session("konu_cat_id")&"&id="&Session("konu_id")&""" />")
elseif Session("bolum_img")=2 then
Response.write ("<meta http-equiv=""Refresh"" content=""1;URL=konu_ekle.asp?cat_id="&Session("konu_cat_id")&"&isle=2&id="&Session("konu_id")&""" />")
end if
END IF
%>
</body>
</html>