I don't like WordPress, and I have worked professionally with it for a long time. My post called "WordPress is stupid" consistently gets traffic, unfortunately it doesn't have good content. Fortunately I moved on from WordPress a few years ago.
With this you can upload images through your plugin/theme. They are saved as attachments. Please add nonce fields for security reasons. more
With this snippet you can log in a WordPress user automatically. more
See my previous paste for the whole class (minus this) http://kuttler.eu/code/wordpress-plugintheme-options-page/ more
I use helper methods/functions in my themes and plugins to create the input fields, this was simplified for the example here. more
The function should probably check if the post already has the tag/category before adding it a second time. I should probably look into the wpispost_revision() part again as well. more