Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda