here is the my code export const uploadPDF = async (pdf) => { try { console.log("Uploading file:", pdf);
const file = pdf.assets[0];
console.log("Uploading file:", file);
const result = await storage.createFile(
process.env.EXPO_PUBLIC_APPWRITE_BOOKSHOP_BUCKET_ID,
ID.unique(),
file
);
if (!result || !result.$id) {
throw new Error("Failed to upload PDF");
}
const pdfUri = `${process.env.EXPO_PUBLIC_APPWRITE_ENDPOINT}/storage/buckets/${process.env.EXPO_PUBLIC_APPWRITE_BOOKSHOP_BUCKET_ID}/files/${result.$id}/view?project=${process.env.EXPO_PUBLIC_APPWRITE_PROJECT_ID}`;
console.log("✅ PDF uploaded successfully:", pdfUri);
return pdfUri;
} catch (error) { console.error("❌ Error uploading PDF:", error); if (error.response) { console.error("Response:", error.response); } throw error; } };
and here are the logs
(NOBRIDGE) LOG Uploading file: {"assets": [{"mimeType": "application/pdf", "name": "Basic Real Analysis_ Along with a companion volume Advanced Real Analysis ( PDFDrive ).pdf", "size": 5292034, "uri": "file:///data/user/0/host.exp.exponent/cache/DocumentPicker/6081f92f-334d-413f-900e-17f166e15a23.pdf"}], "canceled": false} (NOBRIDGE) LOG Uploading file: {"mimeType": "application/pdf", "name": "Basic Real Analysis_ Along with a companion volume Advanced Real Analysis ( PDFDrive ).pdf", "size": 5292034, "uri": "file:///data/user/0/host.exp.exponent/cache/DocumentPicker/6081f92f-334d-413f-900e-17f166e15a23.pdf"} (NOBRIDGE) ERROR ❌ Error uploading PDF: [AppwriteException: Network request failed]
Recommended threads
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...
- trying to figure out how to activate my...
please help
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support 👋 I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...