backup
This commit is contained in:
1 parent
679934a90a
commit
233c5b8ff5
6 files changed
+47
-6
No files matched your search
@@ -128,3 +128,5 @@ dist
|
|||||||
.yarn/build-state.yml
|
.yarn/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
public/upload/raw
|
||||||
Generated
+22
@@ -9,6 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
"express-fileupload": "^1.4.0",
|
"express-fileupload": "^1.4.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
@@ -580,6 +581,18 @@
|
|||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/cors": {
|
||||||
|
"version": "2.8.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||||
|
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||||
|
"dependencies": {
|
||||||
|
"object-assign": "^4",
|
||||||
|
"vary": "^1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/crypto-random-string": {
|
"node_modules/crypto-random-string": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
||||||
@@ -2878,6 +2891,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||||
},
|
},
|
||||||
|
"cors": {
|
||||||
|
"version": "2.8.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||||
|
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||||
|
"requires": {
|
||||||
|
"object-assign": "^4",
|
||||||
|
"vary": "^1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"crypto-random-string": {
|
"crypto-random-string": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"author": "Selcuk Sari",
|
"author": "Selcuk Sari",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
"express-fileupload": "^1.4.0",
|
"express-fileupload": "^1.4.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ function submitForm(e) {
|
|||||||
for (let i = 0; i < imgFiles.files.length; i++) {
|
for (let i = 0; i < imgFiles.files.length; i++) {
|
||||||
formData.append("files", imgFiles.files[i]);
|
formData.append("files", imgFiles.files[i]);
|
||||||
}
|
}
|
||||||
|
for (key in formData.keys()) {
|
||||||
|
console.log(key);
|
||||||
|
}
|
||||||
fetch("http://localhost:3000/invoice_sign/upload_files", {
|
fetch("http://localhost:3000/invoice_sign/upload_files", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
|
|||||||
@@ -128,14 +128,25 @@ router.get("/download", function (req, res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const multer = require("multer");
|
const multer = require("multer");
|
||||||
const upload = multer({ dest: "./public/upload/raw" });
|
|
||||||
// router.use(express.json());
|
|
||||||
// router.use(express.urlencoded({ extended: true }));
|
|
||||||
|
|
||||||
|
const fileStorageEngine = multer.diskStorage({
|
||||||
|
destination: (req, file, cb) => {
|
||||||
|
cb(null, "./public/upload/raw");
|
||||||
|
},
|
||||||
|
filename: (req, file, cb) => {
|
||||||
|
const fileName = decodeURI(file.originalname);
|
||||||
|
console.log(fileName);
|
||||||
|
cb(null, fileName);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const upload = multer({ storage: fileStorageEngine });
|
||||||
router.post("/upload_files", upload.array("files"), uploadFiles);
|
router.post("/upload_files", upload.array("files"), uploadFiles);
|
||||||
function uploadFiles(req, res, next) {
|
function uploadFiles(req, res) {
|
||||||
console.log(req.body);
|
// console.log(req.body);
|
||||||
console.log(req.files);
|
// console.log(req.files);
|
||||||
|
// console.log(req.files[0].toString("latin1"));
|
||||||
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
res.json({ message: "Successfully uploaded files" });
|
res.json({ message: "Successfully uploaded files" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ block content
|
|||||||
.row
|
.row
|
||||||
.col-sm-8
|
.col-sm-8
|
||||||
h3 Invoice Signer
|
h3 Invoice Signer
|
||||||
|
.progress
|
||||||
|
.progress-bar.progress-bar-animated.progress-bar-striped(role="progressbar",aria-valuenow="30",aria-valuemin="0",aria-valuemax="100",style="width: 25%")
|
||||||
form#form
|
form#form
|
||||||
.m-3
|
.m-3
|
||||||
label.form-label.file-upload-wrapper(for='formFile') Choose a file to embed an image
|
label.form-label.file-upload-wrapper(for='formFile') Choose a file to embed an image
|
||||||
|
|||||||
Reference in new issue
Block a user