-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.jsp
61 lines (58 loc) · 1.61 KB
/
upload.jsp
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
<%@ page import="java.io.*"%>
<%@ page language="java" %>
<%
String user = "";
try{
if(session.getAttribute("user")==null)
response.sendRedirect("login.jsp");
user = (String)session.getAttribute("user");
}
catch(Exception e){
System.out.println("Error");
}
%>
<jsp:include page="header.jsp" />
<center> <h1>Welcome ${user} ! </h1>
<a href="logout.jsp">Logout</a>
</center>
</br>
<head><title>Upload page</title></head></p> <p><body>
<form action="uploadFile.jsp" method="post" enctype="multipart/form-data" name="form1" id="form1">
<center>
<table border="0" bgcolor=#ccFDDEE>
<tr>
<td align="center"><b>File Upload</td>
</tr>
<tr>
<td>
Specify file:<input name="file" type="file" id="file">
<td>
</tr>
</table>
<center>
</form>
<br/>
<table>
<h2> Your Files : </h2>
<tr><th>File Name</th><th>Download File</th><th>Delete File</th></tr>
<tr></tr><tr></tr>
<%
File f = new File("C:/UploadedFiles/" + user );
File[] files = f.listFiles();
for(int i=0;i<files.length;i++){
String name=files[i].getName();
String path=files[i].getPath();
if(!path.contains("SnapsFolder")){
%>
<tr>
<td><%=name%></td>
<td><a href="download.jsp?f=<%=path%>">Download File</a></td>
<td><a href="delete.jsp?f=<%=path%>">Delete File</a></td>
<!-- <td><a href="view.jsp?f=<%=path%>">View File</a></td> -->
</tr>
<%
}}
%>
</table>
</html>
</HTML>