I am building a simple CMS for a client. They need the ability to manage employee profiles.
Each profile needs an image.
Currently I have a form for adding employees, and associating an uploaded image with a single record is easy.
Below the record add form, I have a list of existing records (and a thumbnail of the image). These records are printed between form tags, I've got a checkbox next to each record (marking it will delete it when the form submits).
I want to use this form to also UPDATE records; deletions occur first, then $_POST data is parsed and records updated.
When a record has no image associated with it, instead of a thumbnail, a file input tag is printed. Because there is a variable number of records, the file tags are all named image[] so I can easily loop through them.
Question: how do I correlate $_FILES data with $_POST data? Do I have to name each file input to image_<?=$record_id?> to determine which record the file belongs to?