I’m building a complex gallery component for a client in WordPress. My main stumbling point is creating a media uploader in the admin screen that will let them upload images into different folders. Due to the number of images, organizing by folders is critical.
I essentially need to emulate the functionality of the current WordPress media uploader, but with the ability to create/choose folders for the images.
I don’t really know where to start- Is there a standard way of implementing file uploads in websites that would lend itself to this scenario?
You can use WordPress’s built in upload handler, wp_handle_upload(). You can use the
upload_dir
filter to set the custom directory.Here are some code snippits from one of my plugins that you can use/modify: