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

202
Vistas
FileCloud Upload in JavaScript

I'm trying to upload files in a React application. The following is generate code from a postman request that is working fine:

var myHeaders = new Headers();
myHeaders.append("Cookie", "<insertCookiesHere>");

var formdata = new FormData();
formdata.append("file", fileInput.files[0], "/C:/Users/username/Downloads/image.png");
formdata.append("appname", "explorer");
formdata.append("path", "/myteam/squads/Test/");
formdata.append("offset", "0");
formdata.append("complete", "1");
formdata.append("filename", "image.png");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://ccfilecloud.domain.com/core/upload", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Here is what I'm doing with React which doesn't work. At this point, I'm hardcoding all of this in just to get a working version. From what I can tell I NEED the absolute path to the file on the users' system, or Postman doesn't work. So it has to be manually entered because the browser has no access to that information.

const formData = new FormData();
formData.append(
  'file',
  fileInputElement.current.files[0],
  `/C:/Users/username/Downloads/image.png`
);
formData.append('appname', 'explorer');
formData.append('path', `/myteam/squads/Test/`);
formData.append('offset', '0');
formData.append('complete', '1');
formData.append('filename', 'image.png');

fetch(
  `https://ccfilecloud.domain.com/core/upload`,
  {
    body: formData,
    headers: {
      Cookie: cookies,
    },
    method: 'POST',
    redirect: 'follow',
  }
);

The error I get is an invalid upload path. Grabbing cookies from a login request, parsing them, and using them rather than a normal token is weird, but it's working with other requests. Using form data also feels odd.

Has anyone else used the file cloud API or come across a similar issue with uploading files via form data?

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