Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2.15] FileNotFoundException when uploading file through XHR #12299

Closed
ghost opened this issue Feb 15, 2016 · 18 comments
Closed

[5.2.15] FileNotFoundException when uploading file through XHR #12299

ghost opened this issue Feb 15, 2016 · 18 comments

Comments

@ghost
Copy link

ghost commented Feb 15, 2016

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))
@vinkla
Copy link
Contributor

vinkla commented Feb 15, 2016

+1 I'm also having the same issue on the same very line. I guess the bug could have been introduced in either 1f2124e or 834f562. Anything else we can provide to make it easier to find the issue?

@taylorotwell
Copy link
Member

Hmm getRealPath must be returning false for the file.

@taylorotwell
Copy link
Member

Pushed a commit to fix.

@vinkla
Copy link
Contributor

vinkla commented Feb 15, 2016

👍

@ghost
Copy link
Author

ghost commented Feb 15, 2016

Thank you, Taylor! 👍

@rajeshtandukar
Copy link

I still have this error with my Laravel 5.2
FileNotFoundException in File.php line 37:
The file "/tmp/phpSkmSn7" does not exist

@rajeshtandukar
Copy link

I follow the instruction at #12350 and it works fine.
laravel/framework/src/Illuminate/Http/UploadedFile.php
at Line 50
remove instanceof static

@imtiazPabel
Copy link

I was also fall on this problem in 5.2.16 and in now i am using 5.2.29 and this is solved

@CrixuAMG
Copy link

I follow the instruction at #12350 and it works fine.
laravel/framework/src/Illuminate/Http/UploadedFile.php
at Line 50
remove instanceof static

Doing this fixed the same issue for me in V5.4.35.

@JuliusB
Copy link

JuliusB commented Sep 22, 2017

I have this issue on 5.5.11. And removing instanceof static doesn't help.

@poseso
Copy link

poseso commented Oct 28, 2017

I have the same issue on 5.5.19 and removing instanceof static fixes the problem for me, please fix @taylorotwell

@cyrrill
Copy link

cyrrill commented Nov 13, 2017

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

@kevinreynolds
Copy link

@cyrrill I'm having the same issue as well (using Laravel v5.5.26). Did you manage to find a solution to this one?

@Mr-Anonymous
Copy link

I have the same issue in laravel 5.3. Has anyone found a solution for this? The error I get in some cases when user tries to upload a video is:

Error: The file "" does not exist inFile/MimeType/MimeTypeGuesser.php:123

@MightyPork
Copy link

MightyPork commented Mar 29, 2018

Same error today, does not look fixed

Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "" does not exist in file /srv/fb3/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php on line 121
Stack trace:
  1. Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException->() /srv/fb3/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php:121
  2. Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser->guess() /srv/fb3/vendor/symfony/http-foundation/File/File.php:79
  3. Symfony\Component\HttpFoundation\File\File->getMimeType() /srv/fb3/vendor/symfony/http-foundation/File/File.php:58
  4. Symfony\Component\HttpFoundation\File\File->guessExtension() /srv/fb3/vendor/laravel/framework/src/Illuminate/Http/FileHelpers.php:60
  5. Illuminate\Http\UploadedFile->hashName() /srv/fb3/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php:34
  6. Illuminate\Http\UploadedFile->store() /srv/fb3/app/Http/Controllers/Setup/StorageController.php:39
  7. FlowBox\Http\Controllers\Setup\StorageController->testUpload() /srv/fb3/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
...

@Mr-Anonymous
Copy link

I got a similar error in Laravel 5.3 and I resolved it just recently: #23492

@MightyPork
Copy link

Ah i found my fix - I set upload_max_filesize but then the system unexpectedly rebooted before I could restart httpd, and the change somehow got reverted to 2M.

So - this can happen also when you have too small upload_max_filesize and are uploading a big file. I guess we have to manually check the file object before trying to store it, somehow

@shenAmit
Copy link

Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException"
file
:
"E:\Trainer Portal\tka-trainer-portal\vendor\symfony\http-foundation\File\File.php"
line
:
36
message
:
"The file "C:\xampp\tmp\php1BAA.tmp" does not exist"

when i try to upload a file in chunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests