try using wp_handle_upload filter