• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

473
Views
Sails.JS file upload - can't get a file on req.file()

I've just begun using Sails.JS and I tried to make a simple file upload. In Sails.JS, I've done this:

uploadFile: (req, res) => {
		req.file('avatar').upload({
			dirname: '../../assets/uploads'
		}, function (err, uploadedFiles){
			if (err) return res.serverError(err);
			return res.json({
				message: uploadedFiles.length + ' file(s) uploaded successfully!',
				files: uploadedFiles
			});
		});
	}

For Postman, I've done this: upload file via postman

The problem is, after I upload a file via Postman, I don't get a file in req.file(). However, console.log(req) does show my uploaded file's binary (or something like that). I just can't figure out what happened.

about 3 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error