This topic is locked
[SOLVED]

 Upload image to folder based on field value

6/3/2018 4:22:03 PM
PHPRunner General questions
W
wypman author

On a Add page I have two dropdown boxes and a button to upload an image (using advanced resize options). I would like to use the values in the dropdown boxes to create the location of where the file will be uploaded to.
I have tried using $_SESSION["Folder"] to store the path and create the folder in the 'Before record added' event, which it does. However, it appears the image is uploaded before the 'Before record added' event triggers. How can I change this folder location before the image is uploaded?
Thanks, wypman.

admin 6/4/2018

Files are upload before record is saved so you cannot use any form field values to create a folder.
What you can do is to use AfterAdd or AfterEdit event and move files to desired folder.