We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
먼저 좋은 강의 감사합니다.
fileFilter의 위치가 multer.diskstorage에 넣은경우 그냥 무시가 되서 아무파일이나 업로드가 됩니다. 공식 문서에 따르면 multer가 올바른 위치인 것같습니다. 또한 const path = require('path'); 도 필요해 보입니다.
const path = require('path');
일단 jpg로 테스트해 본 코드를 적어보았습니다.
const path = require('path'); const multer = require('multer'); let storage = multer.diskStorage({ destination: (req, file, cb) => { cb(null, 'uploads/'); }, filename: (req, file, cb) => { console.log(file.mimetype); cb(null, `${Date.now()}_${file.originalname}`); }, }); const upload = multer({ storage: storage, fileFilter: (req, file, cb) => { const ext = path.extname(file.originalname); if (ext !== '.jpg') { console.log('it is not jpg'); return cb(new Error('only jpg is allowed'), false); } cb(null, true); }, }).single('file');
The text was updated successfully, but these errors were encountered:
No branches or pull requests
먼저 좋은 강의 감사합니다.
fileFilter의 위치가 multer.diskstorage에 넣은경우 그냥 무시가 되서 아무파일이나 업로드가 됩니다. 공식 문서에 따르면 multer가 올바른 위치인 것같습니다.
또한
const path = require('path');
도 필요해 보입니다.일단 jpg로 테스트해 본 코드를 적어보았습니다.
The text was updated successfully, but these errors were encountered: