You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Initialize our service with any options it requires
app.use('/pengukuhan-kawasan', upload.single('file_shp'), upload.single('dokumen_sk'),createService(options));
// Get our initialized service so that we can register hooks
const service = app.service('pengukuhan-kawasan');
service.hooks(hooks);
};
`
hello , im problem with feathersjs using multer, im upload multiple field files using different name fields and different location dest . how use multiple fields in feathersjs and multer. thank you :)
The text was updated successfully, but these errors were encountered:
You use upload.single, it's for a single file upload.
Try
app.use('/pengukuhan-kawasan',upload.fields([{name: 'file_shp',maxCount: 1},// available at `req.files.file_shp[0]`{name: 'dokumen_sk',maxCount: 1}// available at `req.files.dokumen_sk[0]`]),createService(options));
You use upload.single, it's for a single file upload.
Try
app.use('/pengukuhan-kawasan',upload.fields([{name: 'file_shp',maxCount: 1},// available at `req.files.file_shp[0]`{name: 'dokumen_sk',maxCount: 1}// available at `req.files.dokumen_sk[0]`]),createService(options));
yes , i use this but if send other file ( no file_shp or dokumen_sk ) , multer resolved error !!!
2 - It is not possible to validate the file ( rar, zip, pdf ) and image ( jpg, png, gif ) separately.
// Initializes the
pengukuhan-kawasanservice on path
/pengukuhan-kawasan`const createService = require('feathers-sequelize');
const createModel = require('../../models/pengukuhan-kawasan.model');
const hooks = require('./pengukuhan-kawasan.hooks');
module.exports = function (app) {
const Model = createModel(app);
const paginate = app.get('paginate');
const multer = require('multer');
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './public/fileshp')
},
filename: function (req, file, cb) {
cb(null, file.originalname);
}
})
const upload = multer({ storage: storage});
const options = {
Model,
paginate
};
// Initialize our service with any options it requires
app.use('/pengukuhan-kawasan', upload.single('file_shp'), upload.single('dokumen_sk'),createService(options));
// Get our initialized service so that we can register hooks
const service = app.service('pengukuhan-kawasan');
service.hooks(hooks);
};
`
hello , im problem with feathersjs using multer, im upload multiple field files using different name fields and different location dest . how use multiple fields in feathersjs and multer. thank you :)
The text was updated successfully, but these errors were encountered: