Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
How to allow upload of large files to linode server using node js multer

Hi guys i got a linode server and am trying to make a file upload through an endpoint to my backend server hosted on my linode server, when i upload files less than 1-2 mb it works but above that it doesn't, i tried testing same upload functionality using heroku it worked, but it doesn't work on my linode server instead my axios returns a "network error" please is there any config i need to do to allow large file upload am using react axios, node js and multer.

my code

        try{

        const formData = new FormData();
        formData.set('txt', textValue)
        formData.set('post_for', PostFor)
        fileList.forEach(element => {
            formData.append('files', element)
        })

        setloading(true)
        setError();
        
        axios.post(`${ENDPOINT}/feed/`, formData,{
            headers:{token:localStorage.token,"Content-Type":"multipart/form-data"},
            onUploadProgress: (data) => {
                setProgress(Math.round(100 * (data.loaded / data.total)));
              },
        }).then(res => {
            if(res.data){
                setloading(false)
                setFileList([])
                setpreviewImage([])
                setpreviewVideo([])
                setText('')
                setError();
                socket.emit('refresh_feed')
                message.success('feed uploaded successfully')
                setTimeout(()=>{
                    setProgress()
                },6000)             
     
         }else if(res.error){
            setloading(false)
             message.error(res.error)
         }
         }) .catch((error) => {
            const code = error
            switch (code) {
              case "FILE_MISSING":
                setError("Please select a file before uploading");
                setloading(false)
                break;
              case "LIMIT_FILE_SIZE":
                setError("File size is too large. Please upload files below 1MB!");
                setloading(false)
                break;
              case "INVALID_TYPE":
                setError(
                  "This file type is not supported. Only .png, .jpg, and .jpeg files are allowed"
                );
                setloading(false)
                break;
              default:
                setError("Sorry, something went wrong");
                setloading(false)
                break;
            }
          });
        }catch (error) {}
    }


const storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, `./src/uploads`)
  },
  filename: function (req, file, cb) {
    // if(file.mimetype === 'video/mp4' || file.mimetype ===  'audio/mpeg'){
    //   return cb(null, Date.now() + '.mp3')
    // }
     cb(null, Date.now() + path.extname(file.originalname))
  }
})
  
  export const upload = multer({ storage: storage })
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!