Closed SOG-web closed 3 weeks ago
have been able to solve it, this is the solution
I had to add fileTypeExtended
as the type
let name = file.fileName?.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
name = name?.replace(/\s/g, "_");
const uriArray = file.uri.split(".");
const fileExtension = uriArray[uriArray.length - 1]; // e.g.: "jpg"
const fileTypeExtended = `${file.type}/${fileExtension}`; // e.g.: "image/jpg"
console.log("File type", fileTypeExtended);
const response = await storage.createFile(
DRIVER_BUCKET_ID,
ID.unique(),
{
name: name!,
type: fileTypeExtended,
size: file.fileSize!,
uri: file.uri,
},
[Permission.read(Role.any()), Permission.write(Role.any())]
);
👟 Reproduction steps
when I try to upload files, I get network request failed. Am using expo
👍 Expected behavior
successful upload of image
👎 Actual Behavior
LOG Error uploading image [AppwriteException: Network request failed]
LOG Error uploading image [Error: Failed to upload image]
Also every other things like database insert, user creation is working without any issues, on the storage is not working
🎲 Appwrite version
Version 0.10.x
💻 Operating system
MacOS
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?