Fix image upload path error in ImageUploadListener (#200)
Commit: 78a5e6376f8089a5e5eecb7672348b945880e3d4
Date: 2025-07-07 16:22:40 +0000
Author: PascalHavelange
Commit Message
Fix image upload path error in ImageUploadListener (#200)
fix: resolve image upload path error in ImageUploadListener
- Fix ImageUploadListener to use correct file path from model
- Previously used file.name instead of file.path causing 'No such file or directory' error
- Update ImageUploadFactory to store complete file path in path field
- Update related tests to match corrected path structure
- Resolves 500 Internal Server Error when uploading images
The issue occurred because:
1. Controller stores full relative path (e.g., 'image_uploads/hash.jpg') in path field
2. Listener incorrectly concatenated directory + original filename
3. This caused exif_imagetype() to fail with file not found error
Changes:
- ImageUploadListener now uses Storage::disk()->path(file.path) directly
- ImageUploadFactory generates correct path structure for testing
- All tests updated to use file.path instead of file.path + '/' + file.name
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Files Changed
- 📝 Modified:
app/Listeners/ImageUploadListener.php
- 📝 Modified:
database/factories/ImageUploadFactory.php
- 📝 Modified:
tests/Feature/Event/AvailableImage/AvailableImageTest.php
- 📝 Modified:
tests/Unit/ImageUpload/FactoryTest.php
Links
This documentation was automatically generated from Git commit data.