{"id":32588,"date":"2016-02-11T14:19:02","date_gmt":"2016-02-11T08:49:02","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=32588"},"modified":"2016-03-03T17:26:35","modified_gmt":"2016-03-03T11:56:35","slug":"stylish-input-type-file-upload-with-image-preview","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/","title":{"rendered":"Stylish input type file upload with image Preview"},"content":{"rendered":"<p>Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers.<\/p>\n<p>Now I found a solution to do this.<\/p>\n<p><strong>Here is the HTML which have been used:-<\/strong><\/p>\n<p>[java]<br \/>\n&lt;div class=&quot;uploadOuter&quot;&gt;<br \/>\n            &lt;input type=&quot;text&quot; class=&quot;uploadText&quot;\/&gt;<br \/>\n            &lt;input type=&quot;file&quot; class=&quot;uploadFile&quot;\/&gt;<br \/>\n        &lt;\/div&gt;<br \/>\n\t\t&lt;div class=&quot;Preview&quot;&gt;<br \/>\n\t\t&lt;img src=&quot;&quot; alt=&quot;&quot;\/&gt;<br \/>\n\t\t&lt;span class=&quot;loader&quot;&gt;&lt;\/span&gt;<br \/>\n\t\t&lt;\/div&gt;<br \/>\n[\/java]<\/p>\n<p>At first I have taken an outer div with name \u201cuploadOuter\u201d, then inserted an input type: text field showing the path of files selected locally. Afterwards, I have placed input type file which placed over the input type:text. Also I had set the opacity:None. For IMG Preview purpose I have taken &#8216;Preview&#8217; div.<\/p>\n<p>By using jQuery I have showcased the path of the selected file into the input type text and image Preview.<\/p>\n<p><strong>Here is the CSS which have been used:-<\/strong><\/p>\n<p>[java]<br \/>\n*{box-sizing:border-box;}<br \/>\n            .uploadOuter {margin: 6px 0;min-height:30px;border:1px solid #ccc;position: relative;width: 310px;}<br \/>\n            .uploadFile {opacity: 0;position: absolute;right: 0;top: 0;z-index: 2;height:100%; width: 100%;}<br \/>\n            .uploadText{width:100%;height:100%;position:absolute;border:none;padding:0 0 0 10px;background: url(&#8216;imagePathOfBrowseButton&#8217;) no-repeat right center}<br \/>\n\t\t\t.Preview{width:200px;border:1px solid #ccc;position:relative;display:none}<br \/>\n\t\t\t.Preview img{width:100%;}<br \/>\n\t\t\t.loader{position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.5) url(&#8216;imagePath&#8217;) no-repeat center center;z-index:99; }<br \/>\n[\/java]<\/p>\n<p><strong>Here is the jQuery which have been used:-<\/strong><\/p>\n<p>[java]<br \/>\n$(function(){<br \/>\n\t\t\t\t$(&#8216;.uploadFile&#8217;).change(function(e){<br \/>\n\t\t\t\t$(&#8216;.loader&#8217;).show();<br \/>\n\t\t\t\t$(&#8216;.Preview&#8217;).show();<br \/>\n\t\t\t\t\tvar filePath = URL.createObjectURL(e.target.files[0]);<br \/>\n\t\t\t\t\tvar fileName = e.target.files[0].name;<br \/>\n\t\t\t\t\t\/\/var fileName = $(this).val();<br \/>\n\t\t\t\t\t$(&#8216;.uploadText&#8217;).val(fileName);<br \/>\n\t\t\t\t\t$(&#8216;.Preview img&#8217;).attr(&#8216;src&#8217;,filePath);<br \/>\n\t\t\t\t\t$(&#8216;img&#8217;).load(function(){<br \/>\n\t\t\t\t\t$(&#8216;.loader&#8217;).hide();<br \/>\n\t\t\t\t\t})<br \/>\n\t\t\t\t});<br \/>\n\t\t\t});<br \/>\n[\/java]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java] &lt;div class=&quot;uploadOuter&quot;&gt; &lt;input type=&quot;text&quot; class=&quot;uploadText&quot;\/&gt; &lt;input type=&quot;file&quot; class=&quot;uploadFile&quot;\/&gt; &lt;\/div&gt; &lt;div [&hellip;]<\/p>\n","protected":false},"author":228,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32588","post","type-post","status-publish","format-standard","hentry","category-technology"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Milan Kishor Chourasia\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Stylish input type file upload with image Preview | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Stylish input type file upload with image Preview | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#article\",\"name\":\"Stylish input type file upload with image Preview | TO THE NEW Blog\",\"headline\":\"Stylish input type file upload with image Preview\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/milanc\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2016-02-11T14:19:02+05:30\",\"dateModified\":\"2016-03-03T17:26:35+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#webpage\"},\"articleSection\":\"Technology\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#listItem\",\"name\":\"Stylish input type file upload with image Preview\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#listItem\",\"position\":3,\"name\":\"Stylish input type file upload with image Preview\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/milanc\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/milanc\\\/\",\"name\":\"Milan Kishor Chourasia\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/dc743c1a-cd8f-4a07-b1d8-a48baef5a8ff_1484-Milan-Kishor-Chourasia-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Milan Kishor Chourasia\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/\",\"name\":\"Stylish input type file upload with image Preview | TO THE NEW Blog\",\"description\":\"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/stylish-input-type-file-upload-with-image-preview\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/milanc\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/milanc\\\/#author\"},\"datePublished\":\"2016-02-11T14:19:02+05:30\",\"dateModified\":\"2016-03-03T17:26:35+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Stylish input type file upload with image Preview | TO THE NEW Blog","description":"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]","canonical_url":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#article","name":"Stylish input type file upload with image Preview | TO THE NEW Blog","headline":"Stylish input type file upload with image Preview","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/milanc\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"datePublished":"2016-02-11T14:19:02+05:30","dateModified":"2016-03-03T17:26:35+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#webpage"},"articleSection":"Technology"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.today\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.today\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#listItem","name":"Stylish input type file upload with image Preview"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#listItem","position":3,"name":"Stylish input type file upload with image Preview","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.today\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.today\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.today\/blog\/author\/milanc\/#author","url":"https:\/\/2thenew.today\/blog\/author\/milanc\/","name":"Milan Kishor Chourasia","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/dc743c1a-cd8f-4a07-b1d8-a48baef5a8ff_1484-Milan-Kishor-Chourasia-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Milan Kishor Chourasia"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#webpage","url":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/","name":"Stylish input type file upload with image Preview | TO THE NEW Blog","description":"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/milanc\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/milanc\/#author"},"datePublished":"2016-02-11T14:19:02+05:30","dateModified":"2016-03-03T17:26:35+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.today\/blog\/#website","url":"https:\/\/2thenew.today\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Stylish input type file upload with image Preview | TO THE NEW Blog","og:description":"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]","og:url":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/","og:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Stylish input type file upload with image Preview | TO THE NEW Blog","twitter:description":"Few days back I have tried to change the look of input type file but unable to change like background,border etc. Actually, it looks different in all browsers. Now I found a solution to do this. Here is the HTML which have been used:- [java]","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"32588","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","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":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","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":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 15:00:36","updated":"2024-02-29 09:26:22","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tStylish input type file upload with image Preview\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.today\/blog"},{"label":"Technology","link":"https:\/\/2thenew.today\/blog\/category\/technology\/"},{"label":"Stylish input type file upload with image Preview","link":"https:\/\/2thenew.today\/blog\/stylish-input-type-file-upload-with-image-preview\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/32588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/users\/228"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=32588"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/32588\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=32588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=32588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=32588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}