Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:34:09+00:00 2026-06-15T17:34:09+00:00

I have a MySQL table in which some data blob data is stored in

  • 0

I have a MySQL table in which some data blob data is stored in a cell.

I tried to echo it.

But I don’t know about the mime type of that data. How do I decide the mime type from the given blob data?

I tried this code but don’t know about the mime type of blob:

<?php

    mysql_connect("localhost","root","");
    mysql_select_db("contents");
    $sql="SELECT * FROM `contents` limit 1";
    $result=mysql_query($sql);
    $row=mysql_fetch_assoc($result);
    echo $row['html']

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:34:10+00:00Added an answer on June 15, 2026 at 5:34 pm

    You must add mime with insert “blob” in db for if you force ,you can choose this way :

    if (!function_exists('mime_content_type ')) {
        function mime_content_type($filename) {
            $finfo    = finfo_open(FILEINFO_MIME);
            $mimetype = finfo_file($finfo, $filename);
            finfo_close($finfo);
            return $mimetype;
        }
    }
    
    $filename = tempnam('/tmp', 'cre');
    $fp = fopen($filename, 'w'); 
    fwrite($fp, $row['html']);
    fclose($fp); 
    
    $ctype = mime_content_type($filename) ;
    
    
    header("Content-Type: $ctype");
    header("Content-Disposition: attachment; filename=\"".'samename'."\";" );
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($filename)); 
    unlink($filename);
    echo $row['html'];
    

    This way is not good , because have many usage , but is possible.
    I offer you update table and add mime-type and edit all record by top code …

    And you have second way and use :

      header("Content-type: application/force-download");
    

    This is force download header and can save files in user’s PC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table which I want to populate with some dummy data
I have a table which already contains an index in MySQL. I added some
I have a mysql table field set as time type which stores data in
I have to insert some data into a MySQL table. The data will be
I have some code which needs to ensure some data is in a mysql
I have a table which show data from mysql database in HTML table like
I have a mysql table which holds lots of data across multiple tables. So
I have a mysql table , which holds data like this. Name |how_out |runs
I have a JTable that get's populated with data from a MySQL Table, but
Let's assume we have MySQL table events from which we'll select a data. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.