How to upload images using Settings API

I want to allow users to upload images for use in a rotating banner. I tried using the media library, but didn’t get much help … So I thought, I’d just implement the upload myself. But I encountered another problem… I am using the settings API they do the update options and stuff for me. How can I handle the upload then?

I thought of using the validate callback to upload images and then set $_POST variables manually so that Settings API can save those. But it sounds wrong. Any ideas?

1 Answer
1

You should only need a list of URL’s selected from the Media Loader. There are others out there, but I have a Theme Options Panel for your admin that is Settings API compliant. It has an ‘upload’ option that uses the Media Loader to upload a file and fill a text field with the returned URL of that file. This is saved as an option with the Settings API. Perhaps you can get an idea from that. You could provide a pre-set amount of ‘upload’ options (5 URLS/images for example) or modify the code to handle it differently.

Theme Options Panel Framework

Leave a Comment