How to upload a file from server?

Hi - I am trying to upload a file in a route. No server actions or form. I just have a simple file sitting in my root directory I would like to upload to uploadthing as part of my POST function.

Running into trouble with the input. I tried using form-data package in node to make ti work but no dice. Any tips on how to do this?

Some code I tried. I created a read stream for the zip file and tried to upload it.

  const formData = new FormData();
  const fileStream = fs.createReadStream(outputZipFile);
  formData.append('file', fileStream, { filename: 'output.zip', contentType: 'application/zip' });
  const response = await utapi.uploadFiles(formData);


Appreciate any help!
Was this page helpful?