You need to create a path and use in put method instead of $imageName to store in that particular path of bucket. It'll create the folder itself according to path.
For e.g. if you set the path as $path = "folder_1/folder_2/file.pdf", s3 driver will store file.pdf in folder_2 which is inside folder_1.