问题
I am using sails js. I am trying to upload an array of files and create record for each file in mongodb. In db, I will be storing filename. i am uploading PDF files here. But as the size increases to 1 MB, The file is geeting uploaded but the text fields from the HTML end are missing. If the files size is reduced, then everything is going smooth. Where am I going wrong? Can someone help me.
var f= req.file('ifile')
f.upload({dirname:'../../assets/images/logs'}, function whenDone(err, files) {
if (err) return res.serverError(err);
else if(files.length==0){
message="No file uploaded-log";
console.log(message);
}
else{
for(i=0;i<files.length;i++){
a=files[i].fd.toString();var start=a.lastIndexOf('\\');
a=a.substring(start+1)
console.log(a)
Incident.create({username:username,recorddate:date,type:type,month:month,year:year,inc:inc,incdesc:incdesc[i+1],idate:idate[i+1],itime:itime[i+1],sysaffected:sysaffected[i+1],solution:solution[i+1],prevmes:prevmes[i+1],ifile:a}).exec(function (err,fij){
if (err) return res.serverError(err);
console.log(fij)
}); }}
});
}
来源:https://stackoverflow.com/questions/63603379/sails-js-file-uploads-file-uploaded-successfully-but-text-params-are-missing-wh