Versione Laravel: 8.81
Versione PHP: 7.4.27
Driver e versione del database: MySQL 8
league/flysystem: 1.1.9
Descrizione:
I am facing a problem in the context of a Laravel application related to uploading and managing files through the built-in storage system (Filesystem). The problem manifests as follows:
Upload Operations and Generated Path:
The store method is used to save a file to the storage/app/imports directory.
The path generated by the store method is correctly logged, indicating that the file was presumably saved with a hash name in the desired location.
example of printed log
[2024-11-22 12:29:25] prod.INFO: Path generato: imports/aWZzHU9JIQApMGomxFavQ1MI7fxWn7tnWqt29R5U.xlsx
When the code tries to access the saved file using the generated path, the system (flysystem) throws an exception. This implies that the file is not found or the path passed is not recognized correctly.
The path check ($path) seems correct, and the logs indicate that the file exists at the time of upload.
However, the storage system throws an exception when trying to interact with the file.
` $file = $request->file('file');
$path = $file->store('imports');
$nome_file = $file->hashName();
$nome_file_no_ext = basename($nome_file, '.xlsx');
try {
VoucherImport::dispatch($nome_file_no_ext, $request->id_account, $request->id_agenzia,$path);
} catch (\Throwable $th) {
if ($th->getCode() == 999)
return $this->getErrorResponse($th->getMessage());
else throw $th;
}`
League\Flysystem\FileNotFoundException: File not found at path: imports/aWZzHU9JIQApMGomxFavQ1MI7fxWn7tnWqt29R5U.xlsx