test3
Browse files
main.py
CHANGED
@@ -66,6 +66,10 @@ def ajouter_image():
|
|
66 |
|
67 |
# Obtenir le chemin absolu du dossier `BD_photo`
|
68 |
path_to_bd_photo = os.path.abspath("BD_photo")
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Enregistrer l'image dans le dossier `BD_photo`
|
71 |
image_a_ajouter.save(path_to_bd_photo + "/" + image_a_ajouter.filename)
|
|
|
66 |
|
67 |
# Obtenir le chemin absolu du dossier `BD_photo`
|
68 |
path_to_bd_photo = os.path.abspath("BD_photo")
|
69 |
+
|
70 |
+
if not os.access(path_to_bd_photo, os.W_OK):
|
71 |
+
# Donner les permissions d'écriture au dossier `BD_photo`
|
72 |
+
os.chmod(path_to_bd_photo, os.W_OK)
|
73 |
|
74 |
# Enregistrer l'image dans le dossier `BD_photo`
|
75 |
image_a_ajouter.save(path_to_bd_photo + "/" + image_a_ajouter.filename)
|