Back

Empty file uploaded using sdk-for-node

  • 1
  • Storage
  • Cloud
sagittarius_k2
16 Nov, 2024, 03:56

I am trying to upload a file using below code on storage. It uploads a file with mimeType: 'application/x-empty' and 0 size. Actual file is not uploaded. What wrong am I missing here?

TypeScript
await storage.createFile(
    bucketId,
    ID.unique(),
    InputFile.fromPath(pdfPath, "file.pdf")
  );
TL;DR
The uploaded file is empty, with a 0 size and `mimeType: 'application/x-empty'`. The issue might be with the file upload code provided in the message. Solution: Check if the file is being read correctly before upload using the provided code snippet.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more