Sails Js File uploads. file uploaded successfully but text params are missing while

五迷三道 提交于 2021-02-11 12:10:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!