added image feedback on upload

This commit is contained in:
Expand-sys 2022-01-10 10:35:20 +11:00
parent a5480d5048
commit 4c5b1802b9
10 changed files with 10 additions and 4 deletions

View file

@ -120,7 +120,7 @@ app.post("/upload", upload, function(req, res) {
}
}
);
fs.rmdir(
fs.rm(
"./public/uploads/" + req.files.file.uuid,
{ recursive: true },
function(err) {
@ -142,7 +142,7 @@ app.post("/upload", upload, function(req, res) {
}
}
);
fs.rmdir(
fs.rm(
"./public/uploads/" + req.files.file.uuid,
{ recursive: true },
function(err) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -10,11 +10,17 @@
<body>
<form action="/upload" method="POST" enctype="multipart/form-data">
<legend>Whos Cat is That??!?</legend>
<input type="file" name="file">
<input type="file" name="file" onchange="loadFile(event)">
<img id="output" width="200" />
<button type="submit" class="btn btn-primary">Upload</button>
</form>
center
p not 100% success rate pls dont be too mad if it gets things wrong
script.
var loadFile = function(event){
var image = document.getElementById('output');
image.src = URL.createObjectURL(event.target.files[0]);
};
</body>
</html>