FileUpload on edit page
I have a standalone table with actions. One of the actions is Edit which takes me to the edit page where I have a standalone form. There I have some Placeholders and Text Inputs, which all load the information about my package just fine. I then have a TableRepeater with a TextInput and a FileUpload. The Repeater is designed to hold information about documents that belong to the package. I can display the information regarding the document name on the TextInput fine. Still, I have not been able to have the FileUpload get 'loaded' with the image belonging to the document. I have verified all of the recommendations mentioned in the documentation and on some posts here, such as the correct URL, CORS, and path. When creating the record on the 'Create' page, I should mention that the images are saved to S3 with no issues. The issue is on the edit page, which displays no console errors.
Inside my mount method I am doing this:
and the code for the repeater/FileUpload is this:
I read a post here about Filament creating a temp URL when using S3, so I am not sure if the issue could be me missing something. Someone else also asked about loading the image on the edit page, but I think it was unanswered.
I have also looked at the demo code, but I do not see anything specific that could be missing.
Lastly, I should add that if I dd($$this->documents) I get something like this which shows the correct image path for each document.
Inside my mount method I am doing this:
$this->documents = $package->documents->map(function ($document) {
return [
'document_name' => $this->package->provider === 1
? $document->documentSet1->name
: $document->documentSet2->name,
'file_name' => $document->image->file_name,
];
})->toArray();$this->form->fill([
'package_name' => $this->package->name,
'created_at' => $this->package->created_at,
'updated_at' => $this->package->updated_at,
'documents' => $this->documents,
]);and the code for the repeater/FileUpload is this:
Section::make('Document Details')
->schema([
TableRepeater::make('documents')
->columnWidths([
'document_name' => '50%',
])
->schema([
TextInput::make('document_name')
->string()
->label('Document Name')
->disabled(),
FileUpload::make('file_name')
->acceptedFileTypes(['application/pdf', 'image/tiff'])
->disk('s3')
->directory('submitted'),
])
->disableItemMovement()
->disableLabel()
->hideLabels()
->columnSpan(2)
->disableItemCreation()
->disableItemDeletion(),
])
->compact()
->columnSpan(2),I read a post here about Filament creating a temp URL when using S3, so I am not sure if the issue could be me missing something. Someone else also asked about loading the image on the edit page, but I think it was unanswered.
I have also looked at the demo code, but I do not see anything specific that could be missing.
Lastly, I should add that if I dd($$this->documents) I get something like this which shows the correct image path for each document.
array:2 [▼ // app/Http/Livewire/PackagesEdit.php:41
0 => array:2 [▼
"document_name" => "TestName1"
"file_name" => "submitted/TestName1Image.pdf"
]
1 => array:2 [▼
"document_name" => "TestName2"
"file_name" => "submitted/TestName2Image.pdf"
]
]