<html>
<head>
<title>Resim Yükle</title>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-1254"
>
<LINK href=
"../images/links.css"
rel=
"stylesheet"
>
<script language=
"_JavaScript"
>
function S_im()
{
var tm=new Image();
var o=document.all;
if (o.statu.value==
"ok"
) {
tm.src=o.upi.src;
window.location=
"Limage.asp?fn="
+o.fn.value+
"&w="
+tm.width+
"&h="
+tm.height+
"&qstr=<%=Request.ServerVariables("
QUERY_STRING
")%>"
;
}
}
</script>
</head>
<body onfiltered=
<%
dim ImageType,Ft_Filename
ImageType=false
Dim
q
q = Chr(34)
Dim
aAllDataB, aAllData, x, aHdr
aAllDataB = Request.BinaryRead(Request.TotalBytes)
For
x = 1
To
LenB(aAllDataB)
aAllData = aAllData & Chr(AscB(MidB(aAllDataB, x, 1)))
Next
aHdr = Left(aAllData, Instr(aAllData,vbCrLf)+1)
%>
<%
Response.Write GetFileData(
"file1"
) &
"<br><br>"
Response.Write GetFileData(
"file2"
) &
"<br><br>"
Dim
aFilename
Ft_FileName=GetFileName(
"file1"
)
aFilename = Server.MapPath(
"images/Users"
) &
"/"
& Ft_FileName
Set
FSO1 = server.CreateObject(
"Scripting.FileSystemObject"
)
if FSO1.FileExists(aFilename) then
Dim
tfl
tfl=Ft_Filename
x=instr(tfl,
"."
)
if x>0 then
if userId=
""
then userId=1
tfl=Mid(tfl,1,x-1)&
"_"
&Second(time)&
"."
&Right(tfl,3)
aFilename = Server.MapPath(
"images/Users"
) &
"/"
& tfl
Ft_FileName=tfl
end if
end if
Set
FSO1=nothing
Call
SaveFile(
"file1"
, aFilename)
%>
<%
Function
GetFileName(aField)
Dim
x2, i
x = Instr(aAllData, aHdr &
"Content-Disposition: form-data; name="
&q&aField & q)
x = Instr(x, aAllData,
"filename="
& q)
x2 = Instr(x, aAllData, vbCrLf)
For
i = x2
To
x
Step
-1
If
Mid(aAllData,i,1) = "\"
Then
x = i - 9
Exit
For
End
If
Next
GetFileName = Mid(aAllData, x+10, x2-(x+11))
End
Function
Function
GetFileData(aField)
Dim
x2
x = Instr(aAllData, aHdr &
"Content-Disposition: form-data; name="
& q &aField & q)
x = Instr(x, aAllData, vbCrLf)
x = Instr(x+1, aAllData, vbCrLf)
x = Instr(x+1, aAllData, vbCrLf) + 2
x2 = Instr(x, aAllData, Left(aHdr,Len(aHdr)-2))
GetFileData = Mid(aAllData, x+2, x2-x-4)
End
Function
Function
SaveFile(aField1, aFilename)
bh=lcase(aFileName)
if instr(bh,
".gif"
)>0 then ImageType=true
if instr(bh,
".jpg"
)>0 then ImageType=true
if instr(bh,
".png"
)>0 then ImageType=true
if instr(bh,
".bmp"
)>0 then ImageType=true
Dim
FSO, TS
Set
FSO = server.CreateObject(
"Scripting.FileSystemObject"
)
if ImageType then
Set
TS = FSO.CreateTextFile(aFilename,
True
,
False
)
on error resume next
if ImageType then TS.Write GetFileData(aField1)
TS.Close
if ImageType then
Set
TS =
Nothing
Set
FSO =
Nothing
End
Function
%><%
If
not ImageType then %>
<input type=
"Hidden"
name=
"statu"
value=
"badfile"
>
<div align=
"center"
>
Hatalı Dosya formatı.<br>
<a href=
"_javascript:window.history.go(-1)"
>Geri Dön</a>
</div>
<%
Else
%>
<input type=
"Hidden"
name=
"statu"
value=
"ok"
>
<input type=
"Hidden"
name=
"fn"
value=
"<%=trim(Ft_FileName)%>"
> <strong>Lütfen Bekleyiniz...</strong><br>
<IMG name=
"upi"
SRC=
"images/users/<%=trim(Ft_FileName)%>"
>
<%
End
If
%>
</body></HTML>