IamtheFuture
am trying to upload files but am gettin
Error uploading image [AppwriteException: Network request failed]
TypeScript
export const uploadDriver = async (file: ImagePickerAsset) => {
try {
// remove all spaces, special characters and convert to lowercase
let name = file.fileName?.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
name = name?.replace(/\s/g, "_");
const response = await storage.createFile(
DRIVER_BUCKET_ID,
ID.unique(),
{
name: name!,
type: file.type!,
size: file.fileSize!,
uri: file.uri,
},
[Permission.read(Role.any()), Permission.write(Role.any())]
);
return response;
} catch (error) {
console.log("Error uploading image", error);
throw new Error("Failed to upload image");
}
};
TL;DR
Issue: Developers are encountering a network error when trying to upload files. The error message reads `Error uploading image [AppwriteException: Network request failed]`.
Solution: Check the network connectivity and ensure all data fields are correctly filled out. Also, double-check the permissions for reading and writing to the file. If the issue persists, decline the error message and inform the developer that the image upload failed. Recommended threads
- Getting payload is too large response fr...
I'm encountering a 412 "Payload Too Large" error while trying to upload a 100MB file via Appwrite function to an external storage service api. Could you suggest...
- Is it possible to use the Appwrite Funct...
I’m trying to get a handle on the ‘Functions’ feature in Appwrite. I have a Python repository on GitHub that performs image processing, and I want to integrate ...
- I do SSR auth. What's the best way to se...
I am currently handling authentication entirely server-side via an `/api/auth` endpoint, so I don't have any Appwrite client instances running client-side. Ho...