79165890

Date: 2024-11-07 10:08:46
Score: 3
Natty:
Report link

i also have the same error. here is my code i always get a 403 fordden

export const pickImage = async () => {
  const { status } = await ImagePicker.requestMediaLibraryPermissionsAsync();
  if (status !== "granted") {
    alert("Permission to access media library is required!");
    return;
  }

  const result = await ImagePicker.launchImageLibraryAsync({
    mediaTypes: ImagePicker.MediaTypeOptions.All,
    allowsEditing: true,
    aspect: [4, 3],
    quality: 1,
    base64:true
  });

  if (!result.canceled) {

    const uri = result.assets[0].uri;
    const fileName = uri.split('/').pop();
    const fileType = mime.getType(uri) || "image/jpeg";

    if (Platform.OS === 'web') {
      // Conversion en Blob pour le web */
      const response = await fetch(uri);
      const blob = await response.blob();

      file = new File([blob], fileName, { type: fileType });
     } else {
     
  /*     {
        uri:
          Platform.OS === "android"
            ? pickedImage.uri
            : pickedImage.uri.replace("file://", ""),
        name: "tata.jpeg",
        type: "image/jpeg",
      } */
      // Utilisation de l'URI directement pour le mobile
      file = {
        uri:  Platform.OS === "android" ? uri
        : uri.replace("file://", ""),
        name: fileName,
        type: fileType,
      }; 
      console.log(file);
/*       console.log("voire ",file.name) */
    } 

        return {
      response: file,
      error: null,
    }; 
  }

  return null;
};
Reasons:
  • RegEx Blacklisted phrase (1): i also have the same error
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): i also have the same error
  • Low reputation (1):
Posted by: Myriaque Koko