Next, I have an upload form so that the user can post some images, and it is necessary that he is logged in to post, in each post the maximum number of allowed images is 5, he was following this idea to create the name of the file:
1-5_infixo_1.jpg
1-5_infixo_2.jpg
Where 1 is the id of the logged-in user, 5 is the id of the post plus any any infix and the number would be generated by a loop repeat, a foreach for example. The problem with this is that the post id will only be generated after the success of the upload so I could not use it to rename the file, how can I create a single-named file following a similar logic?