It's probably possible to use the @entangle helper.
https://laravel-livewire.com/docs/2.x/alpine-js#sharing-state
Hi hope somebody can help me, Im trying to send a file from alpine to a livewire function, Im not using livewire internal WithFileUploads
<input type="file" id="file_upload" x-ref="file_upload" x-on:change="onChangeFile($refs.file_upload.files[0])">
async onChangeFile(fileUploaded) {
var file = await this.toBase64(fileUploaded);
await this.$wire.uploadFile(file);
}
public function uploadFile($file){
ray('uploadFile', $file);
//$file = base64_decode(str_replace(' ','+', $file)); doesn't work
//upload in S3 code, I have this
return true;
}
Sending the file directly appears as null, and using base64 doesn't contain
@nam_co the uploaded file needs to bound to a livewire property, which will then contain an instance of temporary upload object which you can work with. You shouldn't be trying to access the file directly.
Please or to participate in this conversation.