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

204
Views
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
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!