How to get non image recently uploaded temp file name in Laravel Livewire

3.2k Views Asked by At

I am using Livewire to upload a non image file.

When uploading the file, Livewire automatically generates a long name for the temporary file and stores it in the default livewire-tmp directory.

I want to know how to retrieve the recently uploaded temporary file name, since I want to delete it after import processing or deleting the file, so that the contents of that directory will not grow with lots of temporary files.

In the docs it is stated the following:

Note: for security reasons, temporary urls are only supported for image uploads.

I have tried the following:

$this->file->temporaryUrl();

But I get the following error:

This driver does not support creating temporary URLs.

Is there a livewire function or a workaround to retrieve that recently uploaded file by Livewire?

1

There are 1 best solutions below

0
On

$this->file->getFilename();

The suggestion by Craig E will return actually the uploading file name and not the temporary name on of the uploade file on the server.