Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
100 views
in Technique[技术] by (71.8m points)

html - Upload multiple .property files and read the data in a table using nodejs javascript

I am trying to upload a property file from UI and save it inside a resource folder

Code for the same :

let express = require("express");
let app = express();
let path = require("path");
let router = express.Router();
let propertiesReader = require("properties-reader");
let properties = propertiesReader("application.properties");
let upload = require("express-fileupload");
const fs = require("fs");

app.use(upload());

app.post("/", function (req, res) {
  if (req.files) {
    // console.log("tests", req.files);
    var file = req.files.file;
    var filename = file.name;

    file.mv("./public/resources/" + filename, function (err) {
      try {
        res.send("file uploaded");
      } catch (err) {
        res.send(err);
      }
    });
  }
});

Html :


 <form method="POST" action="/" enctype="multipart/form-data">
  <input type="file" name="file" />
  <input type="submit" value="upload"/>
</form>

With this code i am able to upload my file in resource folder , now i want to fetch all data from recourse folder and show in a table is it possible to do so ?

question from:https://stackoverflow.com/questions/66066811/upload-multiple-property-files-and-read-the-data-in-a-table-using-nodejs-javasc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...