balderdashy / balderdashy/sails

Multiple file uploads is not working

Open
#7,033 17 comments 0 reactions 0 assignees View on GitHub
helpful info or workaround
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

"node": "^12.16"
"sails-mongo": "^1.2.0"
"sails": "^1.2.3",
"sails-hook-grunt": "^4.0.0",
"sails-hook-orm": "^2.1.1",
"sails-hook-sockets": "^2.0.0",

Above are the versions i am using. my requirements is I will be receiveing array of files from HTML along with 5 arrays of text fields.I am uploading files to my images folder and saving the file name to db using the following code.

[ incdesc=req.body.incdesc;
idate=req.body.idate;
itime=req.body.itime;
sysaffected=req.body.sysaffected;
solution=req.body.solution;
//prevmes:preventive measures
prevmes=req.body.prevmes;
var a='';
console.log(incdesc,idate,itime,sysaffected,solution,prevmes)
var f= req.file('ifile')
console.log(req.session.uid);
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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the upload through req.file('ifile') and the f.upload callback using the listed Sails and Node versions. Inspect how the uploaded files and request text fields are exposed when file sizes increase, then verify that every Incident.create call receives its corresponding text fields and creates a complete record.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.