title: Encode image in base64 format and store in mysql database , not woring for all type of images with php and laravel
body: <p>I have upload one image and want to store it in base64 encoded format in database. for some images it is not working to store in database.</p>
  
  <p>In my local system it is working for all images but on live server it not stores some of images in base64 format in mysql database . my code to store image in database is below,</p>
  
  <pre><code>$handle = $_FILES["file_name"]["tmp_name"];
   $fileObj = $req-&gt;files-&gt;get('file_name');
   $filename = $fileObj-&gt;getClientOriginalName();
   $fileInfo = pathinfo($filename);
   $fileExt = $fileInfo['extension'];
   $file1 = $req-&gt;files-&gt;get('file_name');
   $mime = $file1-&gt;getMimeType();
   $fileName = base64_encode(file_get_contents($handle));
  
  $File = new File();
  $File-&gt;file_name = $fileName;
  $File-&gt;save();
  </code></pre>
  
  <p>from above code if I chane below line then it is working </p>
  
  <p>$fileName = (file_get_contents($handle));</p>
  
  <p>but I want to store it in base64 encoded format in mysql database</p>
  
  <p>in my data table this field's type is "<code>long blob</code>".</p>