I have a plugin that hooks into "wp_handle_upload" filter. Within that scope I'd like to be able to identify where the upload came from, meaning I want to treat it differently if it was uploaded from within a post vs. the media library vs. a plugin/theme settings page (for example the header image for a template).
The only thing passed into my function is an array with file,url,type. Is there a way to identify where it came from?
I could probably create an exception and examine the stack trace, is that a decent solution? If so, what might I be looking for in the stack?
Thanks!