Unable to receive the s3 path url via file upload live
FileUpload::make('file')
->label('File Upload')
->visible(fn() => $question?->type === QuestionTypeEnum::SINGLE_FILE_UPLOAD->value)
->live()
->disk('s3')
->afterStateUpdated(function (
$record,
$state,
FileUpload $component,
$livewire
) {
\Log::info('File upload state:', ['state' => $state]);
return $this->handleFileUploadAnswer($state); }) ->directory(function () use ($periodId, $subjectId, $instituteId) { return "{$instituteId}/{$periodId}/{$subjectId}/subject-tasks/questions/files"; }) ->acceptedFileTypes(FileTypeEnum::from($question->file_mime)->mimeTypes()) ->maxSize($question->file_size * 1024 * 1024) ->required(fn() => $question?->type === QuestionTypeEnum::SINGLE_FILE_UPLOAD->value) ->columnSpanFull(), this should be return the uploaded to s3 link. but it instead returning tmp path. [2025-06-06 21:12:45] local.INFO: File upload state: {"state":{"Livewire\Features\SupportFileUploads\TemporaryUploadedFile":"C:\Users\KagChi\AppData\Local\Temp\phpCE92.tmp"}}
return $this->handleFileUploadAnswer($state); }) ->directory(function () use ($periodId, $subjectId, $instituteId) { return "{$instituteId}/{$periodId}/{$subjectId}/subject-tasks/questions/files"; }) ->acceptedFileTypes(FileTypeEnum::from($question->file_mime)->mimeTypes()) ->maxSize($question->file_size * 1024 * 1024) ->required(fn() => $question?->type === QuestionTypeEnum::SINGLE_FILE_UPLOAD->value) ->columnSpanFull(), this should be return the uploaded to s3 link. but it instead returning tmp path. [2025-06-06 21:12:45] local.INFO: File upload state: {"state":{"Livewire\Features\SupportFileUploads\TemporaryUploadedFile":"C:\Users\KagChi\AppData\Local\Temp\phpCE92.tmp"}}
1 Reply
Of course this is because you are telling it to save the file in S3 but that still doesn't happen.
When you upload a file, it is loaded via LiveWire and has a temporary folder in the configuration, then it is moved during the save to the source.