lara28580's avatar

Serialize TempUploadedFile in Multi Step Form

I am trying to pass a Uploaded Image through to the last step of my multi step form. For the form I am using the Laravel-livewire-wizard. Maybe someone can help me how to properly serialize the uploaded file. The problem is described here but I dont understand the solution. https://github.com/spatie/laravel-livewire-wizard/discussions/61. Please someone can help? Otherwise is there a good tutorial for a multi step form with vue js?

0 likes
5 replies
Snapey's avatar
Snapey
Best Answer
Level 122

store the image in a temporary location and save the filepath as a simple string on your livewire component. Then at the final step move the image to the correct location. Every so often delete old images left in the temporary folder.

1 like
lara28580's avatar

@Snapey Thanks for your answer, really appreciate that. How should I handle validation then, because it's a string and not a tempFileUpload Object anymore. So if the user goes back and forth it always says no image.

Snapey's avatar

@SmokeTM validate it as you first store it, after that you know that what that string leads to is already validated

1 like
lara28580's avatar

@Snapey I can't follow you, because the store step is the last step and there is no tempFileUpload Object anymore so validation is not possible.

Please or to participate in this conversation.