问题
I am using a form to upload video files. For some reason all I get is the following error:
Symfony \ Component \ HttpFoundation \ File \ Exception \ FileNotFoundException
The file "" does not exist
In my controller I had a validation rule to require files, like so
$validator = Validator::make(Input::all(),
array(
'file' => 'required'
)
);
But because of the above rule, I couldn't properly debug what is going on, therefore I ended up removing it, as a result to generate the above error.
回答1:
In the php.ini file, change the following:
upload_max_filesize = 20M
post_max_size = 20M
This should make it work.
回答2:
Probably the problem is the "upload_max_filesize" that has been exceeded (check your php.ini), however it is a good practice to first check if the file is valid.
if (!$file->isValid()) {
throw new \Exception('Error on upload file: '.$file->getErrorMessage());
}
//...
回答3:
To clear the answer The problem that you uploaded file which size is more than php configuration located in php.ini, so when you try to access the any property of the uploadFile object you will see the exception because file not exist
来源:https://stackoverflow.com/questions/22388926/laravel-file-does-not-exist-file-upload