Media Upload to custom database and Custom Directory

I suppose, you didn’t create table imageupload or can’t create folder if_images at your plugin folder.

As a proposal I suggest you to use built-in WordPress functions and wordpress tables or create table on plugin activation.

To create new table use function dbDelta.
If you want to upload user files, use well-documented wp_handle_upload function.

For example:

$uploadedfile = $_FILES['file'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );

More here

To create new row in you database, use $wpdb class.