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
- Facebook's scraper facebookexternalhit g...
share.bardbliss.com but works fine on the raw fra.appwrite.run URL. No execution logs appear when Facebook hits the custom domain. This was working before. How ...
- How to Display File in Web?
I'm trying to use Appwrite's Storage to store images and display them in my app, however when I use the `getFileView`, `getFileDownload` or `getFilePreview` met...
- Project Paused Despite Daily Active Usag...
I noticed that my project was automatically **paused**, even though it is actively being used. The project is an **attendance application** that is used daily b...