framework: [5.2.15] FileNotFoundException when uploading file through XHR
Before updating Laravel (5.2.12), my files (images) were uploading correctly through XHR.
After updating to 5.2.15, I get a FileNotFoundException in File.php line 37 with the following message:
The file “” does not exist
Some more details:
1. in File.php line 37
2. at File->__construct(false, true) in UploadedFile.php line 96
3. at UploadedFile->__construct(false, 'logo-400x400.png', 'image/png', '17215', '0') in UploadedFile.php line 52
4. at UploadedFile::createFromBase(object(UploadedFile)) in Request.php line 415
5. at Request->Illuminate\Http\{closure}(object(UploadedFile))
6. at array_map(object(Closure), array('image_file' => object(UploadedFile))) in Request.php line 416
7. at Request->convertUploadedFiles(array('image_file' => object(UploadedFile))) in Request.php line 401
8. at Request->allFiles() in Request.php line 304
9. at Request->all() in Request.php line 1011
10. at Request->__get('image_src') in TeamController.php line 111
11. at TeamController->saveLogo(object(Request))
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (4 by maintainers)
Same here:
The file "" does not exist {"exception":"[object] (Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException(code: 0): The file \"\" does not exist at /(...)/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php:123) [stacktrace] #0 /(...)/vendor/symfony/http-foundation/File/File.php(79): Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser->guess('') #1 /(...)/app/Services/UploadService.php(59): Symfony\\Component\\HttpFoundation\\File\\File->getMimeType() #2 /(...)/app/Http/Controllers/UploadController.php(21): App\\Services\\UploadService->store(Object(Illuminate\\Http\\UploadedFile), 5, 23) #3 [internal function]: App\\Http\\Controllers\\UploadController->store(Object(Illuminate\\Http\\Request), Object(App\\Services\\UploadService))Using Laravel 5.5.20
I have this issue on 5.5.11. And removing instanceof static doesn’t help.
I follow the instruction at https://github.com/laravel/framework/issues/12350 and it works fine. laravel/framework/src/Illuminate/Http/UploadedFile.php at Line 50 remove instanceof static