-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddblog.html
59 lines (56 loc) · 1.99 KB
/
addblog.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Blog Login</title>
<link rel="stylesheet" href="backend/public/assets/css/addblog.css" />
<script type="module" src="backend/public/assets/js/pages/blog.js"></script>
<style>
textarea {
resize: none;
}
</style>
</head>
<body>
<div class="login-container">
<div class="login-form">
<h2>Add Your Blog</h2>
<form id="uploadForm" enctype="multipart/form-data">
<div class="form-group">
<label for="title">Title:</label>
<input type="text" id="title" name="title" required />
<small class="error-field" id="error-title"></small>
</div>
<div class="form-group">
<label for="image">Image:</label>
<input type="file" id="image" name="image" accept="image/*" required />
<small class="error-field" id="error-image"></small>
<img id="preview" class="image-preview" alt="Preview" />
</div>
<div class="form-group">
<label for="content">Content:</label>
<textarea id="content" name="content" rows="10" required></textarea>
<small class="error-field" id="error-content"></small>
</div>
<button type="submit" class="login-btn">Post</button>
</form>
<div id="uploadProgress" class="upload-progress"></div>
</div>
</div>
<script>
document.getElementById("image").addEventListener("change", function (e) {
const file = e.target.files[0];
const preview = document.getElementById("preview");
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
preview.src = e.target.result;
preview.style.display = "block";
};
reader.readAsDataURL(file);
}
});
</script>
</body>
</html>