#Image Postprocessing

8 messages · Page 1 of 1 (latest)

keen marsh
#

Folks, how do I get the path of an uploaded image? (I want to edit this image by sending it to an API, then replace it)

FileUpload::make('image')
  ->afterStateUpdated(function ($state) {
     $path = $state->getPath();
     log('state', [$path]);
  })

This just returns storage/app/livewire-tmp, and not the actual path of the uploaded image 😦

Thanks in advance!

Also, would it be better to do this after the form is submit, then replace it? I'm not sure..

bold swanBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

rugged geode
#

Hi, your file has not yet been uploaded, it is in the temporary files. It's up to you to determine the path in which you want to store it. You can, however, retrieve the file name.

keen marsh
#

Thank you @rugged geode. How can I send it to an API after it has been submit/upload, to fix it? Is that the correct event?

rugged geode
keen marsh
rugged geode
#

depends of your storage configuration

#

explore your storage folder and you get the path with storage_path() method