如何在db中以二进制格式保存文件?

I need to save files in binary format in my database rather than saving files in directory and inserting file name in the database. Like i get the file by print_r($_FILES) and what is next now??

Table entity data type should be blob

  CREATE TABLE `media`( `id` INT NOT NULL AUTO_INCREMENT, `content` BLOB, PRIMARY KEY (`id`) );

For Example :

    $uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

    if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

      $fileContent = file_get_contents($uploadfile);
      $query = "INSERT INTO `media` (content) VALUES ("$fileContent");
    }

You can create a column with type blob in your database table. Then get the file content using file_get_contents($uploaddir . basename($_FILES['userfile']['name'])) now store it in database column easily by using insertion query.