TransWar File Browser

Path: C:\

<%
filename = Request("filename")
image = Session(Request("img"))
stype = Request("stype")

contentType = "text/html; charset=utf-8"

If Vartype(image) = Vartype("") Then
	Session.Codepage = 65001
	Response.ContentType = contentType
	Response.Write image
Else
	If Ubound(image) >= 2 Then
		c0 = AscB(LeftB(image, 1))
		c1 = AscB(MidB(image, 2, 1))
		c2 = AscB(MidB(image, 3, 1))
		If c0 = &H47 And c1 = &H49 Then
			contentType = "image/gif"
		ElseIf c1 = &H50 And c2 = &H4e Then
			contentType = "image/png"
		ElseIf c0 = &H42 And c1 = &H4d Then
			contentType = "image/bmp"
		ElseIf c0 = &Hff And c1 = &Hd8 Then
			contentType = "image/jpeg"
		ElseIf c0 = 0 And c1 = 0 Then
			contentType = "image/vnd.wap.wbmp"
		Elseif ".svg" = stype Then
			contentType = "image/svg+xml"
		End If
		If c0 = &H1f And c1 = &H8b Then
			Response.AddHeader "Content-Encoding", "gzip"
		End If
	End If
	
	If filename <> "" Then
		Response.AddHeader "Content-Disposition", "inline filename=" & filename
	End If
	
	Response.ContentType = contentType
	Response.BinaryWrite image
End If

Response.End
%>