Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stratboy's avatar

Dropzone (or other realtime uploaders) and associating files db records to posts records, with Laravel

Hi, I think I'm facing a quite common problem, but never did before. It's not a Laravel-specific one, but what I'm asking here is also if Laravel has some smart(er) way to solve it. Cannot find in docs.

So, posts with images. A posts table, and an images one. 1 post to many images. Using dropzone to upload the images. Currently no Livewire, no js frameworks. I want to upload the files to the server when the user drags them to the dropzone, but then I cannot associate them with any post, since the user did not saved it yet. How to?

I was thinking about a field in the images table, where I can save some 'transient' code, which I can then use when I save the related post, to find its images and update the references. Should work.

But, is there any smarter way maybe in Laravel or in general?

0 likes
0 replies

Please or to participate in this conversation.