I'll try to explain what i'm trying to achieve...
I have 2 mysql tables one for items and another for images of the items.
A form where the user will be adding/editing some items.
Problem: When he goes to the form the record is not already created. The idea was to make an insert after. But the user can upload the images before saving the record or refreshing the page (uploading with iframe).
How can i establish a relationship with the images uploaded and the current record?
I thought maybe i could make an insert before go to the edit form, and then fetch the last record and do an update, but if another user is doing the same? maybe the record they fetch is the same, so i guess this is not a solution.
Any ideas how to achieve this?