mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
added file upload and fixed files reads on index page
This commit is contained in:
55
views/upload.ejs
Normal file
55
views/upload.ejs
Normal file
@@ -0,0 +1,55 @@
|
||||
<% include layout.ejs %>
|
||||
|
||||
<body>
|
||||
|
||||
<% include ../public/html/header.html %>
|
||||
<% include ../public/html/navbar.html %>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<form action="/upload" method="post" enctype="multipart/form-data" class="form-file">
|
||||
<h2 class="text-center">File Upload</h2>
|
||||
<br>
|
||||
<input type="password" class="form-control" name="key" placeholder="Key" required>
|
||||
|
||||
<!--<input class="center btn btn-default" type="file" name="file">-->
|
||||
<br>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<span class="btn btn-primary btn-file">
|
||||
Browse… <input type="file" name="file" required>
|
||||
</span>
|
||||
</span>
|
||||
<input id="input_file" type="text" class="form-control" readonly>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Submit</button>
|
||||
|
||||
<br>
|
||||
|
||||
<%
|
||||
if (typeof message != 'undefined'){ %>
|
||||
|
||||
<div class="text-center colorRed"><%=message%></div>
|
||||
|
||||
<%}%>
|
||||
|
||||
</form>
|
||||
|
||||
<h1 class="text-center">Files</h1>
|
||||
<div class="form-file">
|
||||
<% if (typeof files != 'unefined'){
|
||||
for(var i = 0; i < files.length; i++){%>
|
||||
<a href="/uploads/<%=files[i]%>"><%=files[i]%></a>
|
||||
<br>
|
||||
<% }
|
||||
}%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<% include layoutBottom.ejs %>
|
||||
Reference in New Issue
Block a user