create upload dir ;)
This commit is contained in:
parent
0a13b45cdd
commit
75de4b23f8
2
zad2.js
2
zad2.js
@ -6,6 +6,8 @@ const app = express();
|
|||||||
const PORT = 49376;
|
const PORT = 49376;
|
||||||
const UPLOAD_DIRECTORY = './uploads';
|
const UPLOAD_DIRECTORY = './uploads';
|
||||||
|
|
||||||
|
!fs.existsSync(UPLOAD_DIRECTORY) && fs.mkdirSync(UPLOAD_DIRECTORY);
|
||||||
|
|
||||||
const upload = multer({
|
const upload = multer({
|
||||||
storage: multer.diskStorage({
|
storage: multer.diskStorage({
|
||||||
destination: (req, file, cb) => { cb(null, UPLOAD_DIRECTORY); },
|
destination: (req, file, cb) => { cb(null, UPLOAD_DIRECTORY); },
|
||||||
|
Loading…
Reference in New Issue
Block a user