{"id":23,"date":"2009-01-30T07:44:22","date_gmt":"2009-01-30T07:44:22","guid":{"rendered":"http:\/\/kedar.nitty-witty.com\/?p=23"},"modified":"2024-02-06T15:15:57","modified_gmt":"2024-02-06T15:15:57","slug":"upload-image-to-mysql-using-php","status":"publish","type":"post","link":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php","title":{"rendered":"Upload Image to MySQL using PHP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Upload Image to MySQL using PHP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a new-bie to php\/mysql, I tried different stuffs. So here I&#8217;m with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Image Upload code, I&#8217;ve added code download link upload-image-mysql-demo.zip at the end of the page.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE `pix` ( \n `pic_id` int(11) NOT NULL auto_increment,\n `pic_name` varchar(100) NOT NULL,\n `pic_data` longblob NOT NULL,\n PRIMARY KEY\u00a0 (`pic_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Save images to MySQL using PHP<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Image.php*\/\n&lt;?php\n $con = mysql_connect(\"127.0.0.1:3306\",\"root\",\"\");\n if (!$con)\n {\n die(\"Could not connect: \" . mysql_error());\n }\n $DB = mysql_select_db(\"test\", $con);\n move_uploaded_file($_FILES&#91;\"uploadedfile\"]&#91;\"tmp_name\"],\"latest.img\");\n $instr = fopen(\"latest.img\",\"rb\");\n $image = addslashes(fread(fopen(\"latest.img\",\"r\"),filesize(\"latest.img\")));\n mysql_query (\"insert into pix (pic_name, pic_data) values (\"myImage\", \"'.$image.'\");\");\n?>\n\n&lt;html>\n&lt;form enctype=\"multipart\/form-data\" method=\"POST\">\n&lt;img src=showImage.php?gim=1 width=500 height=150 alt=\"hell\">\n&lt;br>&lt;hr>\n&lt;input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\" \/>\nChoose a file to upload(&lt;100 KB): &lt;input name=\"uploadedfile\" type=\"file\" \/>&lt;br\/>\n&lt;input type=\"submit\" value=\"submit\" name=\"submit\" \/>\n&lt;\/form>\n&lt;html><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Show image in MySQL using PHP<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*showImage.php*\/\n&lt;?php\n $con = mysql_connect(\"127.0.0.1:3306\",\"root\",\"\");\n if (!$con)\n {\n die(\"Could not connect: \" . mysql_error());\n }\n $DB = mysql_select_db(\"test\", $con);\n $res = @mysql_query(\"select * from pix order by pic_id desc limit 1\");\n if ($row = @mysql_fetch_assoc($res)) \n {\n $title = htmlspecialchars($row&#91;pic_name]);\n $bytes = $row&#91;pic_data];\n }\n header(\"Content-type: image\/jpg\");\n print $bytes;\n mysql_close();\n?><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Click <a href=\"https:\/\/kedar.nitty-witty.com\/blog\/miscpages\/upload-image-mysql-demo.zip\" title=\"\">here <\/a>to download zip file for above demo of Uploading image to mysql using php.<\/p>\n","protected":false},"excerpt":{"rendered":"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I&#8217;m with my php code for Image Upload to MySQL. Its a quite&hellip;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,378],"tags":[260,910,911,908,909],"class_list":["post-23","post","type-post","status-publish","format-standard","category-mysql","category-mysql-scripts-mysql","tag-image-upload-mysql","tag-mysql-image-upload","tag-php-image-upload","tag-upload-image-to-mysql","tag-upload-image-using-php"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I&#039;m with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I&#039;ve added code download link upload-image-mysql-demo.zip at the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Kedar\"\/>\n\t<meta name=\"google-site-verification\" content=\"_Bu1h5r0PxIC0D2jBVdmYN45RTeG9ogcX85XLkbG1qA\" \/>\n\t<meta name=\"msvalidate.01\" content=\"116B62074CBCA1BA99B8CCE09CCF2FB8\" \/>\n\t<meta name=\"keywords\" content=\"image upload mysql,mysql image upload,php image upload,upload image to mysql,upload image using php\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Change Is Inevitable | Kedar Vaijanapurkar&#039;s Blog for MySQL, technology and various subjects\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Upload Image to MySQL using PHP | Change Is Inevitable\" \/>\n\t\t<meta property=\"og:description\" content=\"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I&#039;m with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I&#039;ve added code download link upload-image-mysql-demo.zip at the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-01-30T07:44:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-02-06T15:15:57+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Upload Image to MySQL using PHP | Change Is Inevitable\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I&#039;m with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I&#039;ve added code download link upload-image-mysql-demo.zip at the\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#article\",\"name\":\"Upload Image to MySQL using PHP | Change Is Inevitable\",\"headline\":\"Upload Image to MySQL using PHP\",\"author\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"},\"datePublished\":\"2009-01-30T07:44:22+00:00\",\"dateModified\":\"2024-02-06T15:15:57+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#webpage\"},\"articleSection\":\"MySQL, MySQL-Scripts, Image upload mysql, MySQL image upload, php image upload, Upload image to MySQL, upload image using PHP\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"name\":\"MySQL\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"position\":2,\"name\":\"MySQL\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-scripts-mysql#listItem\",\"name\":\"MySQL-Scripts\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-scripts-mysql#listItem\",\"position\":3,\"name\":\"MySQL-Scripts\",\"item\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-scripts-mysql\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#listItem\",\"name\":\"Upload Image to MySQL using PHP\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql#listItem\",\"name\":\"MySQL\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#listItem\",\"position\":4,\"name\":\"Upload Image to MySQL using PHP\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/category\\\/mysql\\\/mysql-scripts-mysql#listItem\",\"name\":\"MySQL-Scripts\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\",\"name\":\"Kedar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin\",\"name\":\"Kedar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kedar\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#webpage\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php\",\"name\":\"Upload Image to MySQL using PHP | Change Is Inevitable\",\"description\":\"Upload Image to MySQL using PHP As a new-bie to php\\\/mysql, I tried different stuffs. So here I'm with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I've added code download link upload-image-mysql-demo.zip at the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/upload-image-to-mysql-using-php#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/author\\\/admin#author\"},\"datePublished\":\"2009-01-30T07:44:22+00:00\",\"dateModified\":\"2024-02-06T15:15:57+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/\",\"name\":\"..::CHANGE is INEVITABLE::..\",\"description\":\"Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/kedar.nitty-witty.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Upload Image to MySQL using PHP | Change Is Inevitable","description":"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I'm with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I've added code download link upload-image-mysql-demo.zip at the","canonical_url":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php","robots":"max-image-preview:large","keywords":"image upload mysql,mysql image upload,php image upload,upload image to mysql,upload image using php","webmasterTools":{"google-site-verification":"_Bu1h5r0PxIC0D2jBVdmYN45RTeG9ogcX85XLkbG1qA","msvalidate.01":"116B62074CBCA1BA99B8CCE09CCF2FB8","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#article","name":"Upload Image to MySQL using PHP | Change Is Inevitable","headline":"Upload Image to MySQL using PHP","author":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"publisher":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"},"datePublished":"2009-01-30T07:44:22+00:00","dateModified":"2024-02-06T15:15:57+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#webpage"},"isPartOf":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#webpage"},"articleSection":"MySQL, MySQL-Scripts, Image upload mysql, MySQL image upload, php image upload, Upload image to MySQL, upload image using PHP"},{"@type":"BreadcrumbList","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/kedar.nitty-witty.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","name":"MySQL"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","position":2,"name":"MySQL","item":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql#listItem","name":"MySQL-Scripts"},"previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql#listItem","position":3,"name":"MySQL-Scripts","item":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql","nextItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#listItem","name":"Upload Image to MySQL using PHP"},"previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql#listItem","name":"MySQL"}},{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#listItem","position":4,"name":"Upload Image to MySQL using PHP","previousItem":{"@type":"ListItem","@id":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql#listItem","name":"MySQL-Scripts"}}]},{"@type":"Person","@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person","name":"Kedar","image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"}},{"@type":"Person","@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author","url":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin","name":"Kedar","image":{"@type":"ImageObject","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/be1f7021485c325d92cc4c5d961accb9c1af72b1b11281a790f7f4f066ef10d3?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kedar"}},{"@type":"WebPage","@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#webpage","url":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php","name":"Upload Image to MySQL using PHP | Change Is Inevitable","description":"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I'm with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I've added code download link upload-image-mysql-demo.zip at the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php#breadcrumblist"},"author":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"creator":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/author\/admin#author"},"datePublished":"2009-01-30T07:44:22+00:00","dateModified":"2024-02-06T15:15:57+00:00"},{"@type":"WebSite","@id":"https:\/\/kedar.nitty-witty.com\/blog\/#website","url":"https:\/\/kedar.nitty-witty.com\/blog\/","name":"..::CHANGE is INEVITABLE::..","description":"Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects","inLanguage":"en-US","publisher":{"@id":"https:\/\/kedar.nitty-witty.com\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Change Is Inevitable | Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects","og:type":"article","og:title":"Upload Image to MySQL using PHP | Change Is Inevitable","og:description":"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I'm with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I've added code download link upload-image-mysql-demo.zip at the","og:url":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php","article:published_time":"2009-01-30T07:44:22+00:00","article:modified_time":"2024-02-06T15:15:57+00:00","twitter:card":"summary","twitter:title":"Upload Image to MySQL using PHP | Change Is Inevitable","twitter:description":"Upload Image to MySQL using PHP As a new-bie to php\/mysql, I tried different stuffs. So here I'm with my php code for Image Upload to MySQL. Its a quite simple code with two php files one to display and one to upload. For Image Upload code, I've added code download link upload-image-mysql-demo.zip at the"},"aioseo_meta_data":{"post_id":"23","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-24 17:41:56","updated":"2025-08-16 18:59:42","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\" title=\"MySQL\">MySQL<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql\" title=\"MySQL-Scripts\">MySQL-Scripts<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUpload Image to MySQL using PHP\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/kedar.nitty-witty.com\/blog"},{"label":"MySQL","link":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql"},{"label":"MySQL-Scripts","link":"https:\/\/kedar.nitty-witty.com\/blog\/category\/mysql\/mysql-scripts-mysql"},{"label":"Upload Image to MySQL using PHP","link":"https:\/\/kedar.nitty-witty.com\/blog\/upload-image-to-mysql-using-php"}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":2,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":3245,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions\/3245"}],"wp:attachment":[{"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kedar.nitty-witty.com\/blog\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}