You should also get a stack trace where you can see which of your files the error originates from
Call to undefined function Livewire\tmpfile()
I have moved my app from my local machine to a server and I am getting this error when trying to upload a file. The app still works fine on my local machine.
How do I resolve this?
This is the code that accompanies up with the warning.
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);
$request = Request::capture() is highlighted.
The error in the laravel.log file says
production.ERROR: Call to undefined function Livewire\tmpfile() {"userId":1,"exception":"[object] (Error(code: 0): Call to undefined function Livewire\tmpfile() at /home/user-name/webapps/app-name/vendor/livewire/livewire/src/TemporaryUploadedFile.php:22)
Do you have shared hosting?
https://github.com/livewire/livewire/blob/40519653186241972e42713ad2b38da7abf1f91a/src/TemporaryUploadedFile.php#L22 is probably the line that fails for you. tmpfile() is a regular PHP method, maybe your hosting disabled it for some reason?
Please or to participate in this conversation.