Je vois d'ici: rename a directory or a fileComment puis-je résoudre le fichier introuvable sur le chemin: ... lorsque renommer le fichier? (Laravel)
J'essaie comme ceci:
$destination_path = public_path() . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'products'. DIRECTORY_SEPARATOR . $product->id . DIRECTORY_SEPARATOR . $product->photo;
$new_file_name = public_path() . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'products'. DIRECTORY_SEPARATOR . $product->id . DIRECTORY_SEPARATOR . $new_file_name;
// dd($destination_path, $new_file_name);
Storage::move($destination_path, $new_file_name);
Il existe erreur:
[Ligue \ Flysystem \ FileNotFoundException] Fichier introuvable au chemin: C: /xampp/htdocs/myshop/public/img/products/147/Zl756CDHovOZpEZz0jBYk73UCfO4zNmYDVWgLPpw.png
Si je dd (chemin_destination de $, new_file_name de $), le résultat:
C: \ xampp \ htdocs \ myshop \ produits publics \ img \ \ 147 \ Zl756CDHovOZpEZz0jBYk73UCfO4zNmYDVWgLPpw.png
C: \ xampp \ htdocs \ myshop \ public \ produits img \ \ 147 \-chelsea.png 147 risque
J'essaie de vérifier Zl756CDHovOZpEZz0jBYk73UCfO4zNmYDVWgLPpw.png dans le dossier 147, le fichier existe
Pourquoi il existe une erreur?
Mise à jour:
j'avais trouver la solution. J'utilise un script php comme ceci:
rename($destination_path, $new_file_name);
. Il fonctionne
S'il n'y a personne pour vous aider? –
s'il vous plaît vérifier dd (\ Storage :: exists ($ destination_path)); – honarkhah
Utilisation de stockage C:/xampp/htdocs/myshop/stockage/application – honarkhah