This content originally appeared on CodeSource.io and was authored by Deven
In this short article, i will share how to fix call to a member function getclientoriginalextension() on null error.
If you this error while uploading an imagecall to a member function getclientoriginalextension() on null
This means that no file input has been seen for that file. So, check that you input something in each file input.
Consider the example below:
$file = Input::file('name');
if ($file !== null) {
echo $file->getClientOriginalExtension();
}
Alternatively, you can use guessExtension() method for resolution. The guessExtension() method returns the extension based on the mime type.
Input::file('File')->guessExtension();
This methodology uses the mime type as guessed by getMimeType() to guess the file extension.
The post Fix – call to a member function getclientoriginalextension() on null appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Deven
Deven | Sciencx (2021-02-10T18:10:53+00:00) Fix – call to a member function getclientoriginalextension() on null. Retrieved from https://www.scien.cx/2021/02/10/fix-call-to-a-member-function-getclientoriginalextension-on-null/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.