My suggestion would be to simply save the File Name in the database.
Still let DFP create the folder dynamically, but then just keep the file name in the database.
Then, when you show the image, pull the dynamically created folder based on the recordset.
For example if you have a site member upload their photo, you might create a dynamic folder like "memberphotos_2" where "2" is the id number of the member in the database.
So then when showing the photo, it would look like this:
<img src="memberphotos_<?php echo row_member['id']; ?>/<?php echo row_recordset2['image']; ?>" />