title: Yii2 Upload to BLOB datatype in mysql database not working
body: <p>I got a problem when i want to upload my images/files using BLOB datatype.</p>
  
  <p>i using MYSQL</p>
  
  <p>This is my view</p>
  
  <pre><code>&lt;?php $form = ActiveForm::begin(['options' =&gt; ['enctype' =&gt; 'multipart/form-data']]) ?&gt;
  
  &lt;?= $form-&gt;field($model, 'binaryfile')-&gt;fileInput() ?&gt;
  
  &lt;button&gt;Submit&lt;/button&gt;
  
  &lt;?php ActiveForm::end() ?&gt;
  </code></pre>
  
  <p>This is my Model</p>
  
  <pre><code>public function rules(){
   return [
          [['binaryfile'], 'file', 'skipOnEmpty' =&gt; false, 'extensions' =&gt; 'pdf ,png, jpg'],
          [['fileName'], 'string', 'max' =&gt; 100],
          [['fileType'], 'string', 'max' =&gt; 50],
      ];
  }
  </code></pre>
  
  <p>my Controller</p>
  
  <pre><code>if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
          $model-&gt;binaryfile = UploadedFile::getInstance($model, 'binaryfile');
          $model-&gt;fileName = $model-&gt;binaryfile-&gt;name;
          $model-&gt;binaryfile = file_get_contents($model-&gt;binaryfile-&gt;tempName);
          if ($model-&gt;save()) {
              return $this-&gt;redirect(['site/file-upload']);
          }
      }
  </code></pre>
  
  <p>and this is the error of my problem.
  <a href="https://i.stack.imgur.com/gkFhC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gkFhC.png" alt="enter image description here"></a></p>