Upload file without attaching it to a POST
The $post_id argument for media_handle_upload is used to set the column post_parent for attachment post. Posts without any parent have 0 as post parent, not null. So, use 0 as argument and it will work. If you read Codex page linked above it states: … If you don’t want this media attached to a specific … Read more