How to upload a media file via FTP and then create an attachment post with it?

Yes, the plugin @Squideyes suggests you, is perfectly fine, and should do the trick.

However, I don’t like the link-to-plugin only answers, so here the mine.

If you upload the file to a subfolder of the WordPress uploads folder (by default wp-content/uploads, but can be easily changed) than convert a file from there to an attachment post is pretty easy via code, just a matter of calling with proper arguments:

code ready to a copy&paste is available in Codex here, and copied below:

<?php
// $filename should be the path to a file in the upload directory.
$filename="/path/to/uploads/2013/03/filname.jpg";
// The ID of the post this attachment is for.
$parent_post_id = 37;
// Check the type of tile. We'll use this as the 'post_mime_type'.
$filetype = wp_check_filetype( basename( $filename ), null );
// Get the path to the upload directory.
$wp_upload_dir = wp_upload_dir();
// Prepare an array of post data for the attachment.
$attachment = array(
  'guid'           => $wp_upload_dir['url'] . "https://wordpress.stackexchange.com/" . basename( $filename ), 
  'post_mime_type' => $filetype['type'],
  'post_title'     => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
  'post_content'   => '',
  'post_status'    => 'inherit'
);
// Insert the attachment.
$attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );
// Make sure that this file is included
require_once( ABSPATH . 'wp-admin/includes/image.php' );
// Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );

However, such code without a way to dynamically pass a file path to load is pretty useless, but create a very simple UI for the scope is pretty easy.

Workflow should be:

  1. Hook somewhere to output a form inside upload.php page. Using 'admin_notices' the form will be printed on top of the page. The form will send the request to same page
  2. Hook 'load-upload.php' to check for the POST request, do some checks (a nonce, user capability, existence of the file, check if the file is already attached) and finally use the code from Codex to create the attachment post
  3. use 'admin_notices' hook to output a feedback for user, in both cases the attachment is created or something goes wrong.

The toughest part of this workflow is create the attachment, and for it you already have the code, the other parts, helping yourself with the link I provided, should be very simple.

However, I made a 3-files Gist, with a working plugin that does exactly what said in the workflow above, find it here.

There I added few lines of javascript to allow show/hide form inside upload.php.

Below you can see how my plugin works:

Plugin that create an attachment post from a file already uploaded