troubleshooting Question

Display File Name - Input Type File

Avatar of Joseph Longo
Joseph LongoFlag for United States of America asked on
JavaScriptCSSHTMLJScriptjQuery
1 Comment1 Solution16 ViewsLast Modified:
Hello Experts,
I have the following CSS code, which styles my input file element:
input[type="file"] {
    display: none;
}
.custom-file-upload {
    background: #5ad200; /* For browsers that do not support gradients */
    background: linear-gradient(#5ad200, #337200); /* Standard syntax */
    background: -webkit-linear-gradient(#5ad200, #337200); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(#5ad200, #337200); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(#5ad200, #337200); /* For Firefox 3.6 to 15 */
    border-radius: 3px;
    border-style:none;
    width:200px;
    height:30px;
    color:#FFF;
    font-size:12PX;
    text-align:center;
    clear:both;
    margin-bottom: 2px;
    padding: 10px;
}

Below is my HTML input element:
<td><label for="file" class="custom-file-upload">Upload Picture</label><input type="file" id="file" name="file"/></td>

Upon styling my element, the file name is no longer visible.

I've found this example online, but I am not familiar with javascript or jQuery, so I really do not know where to begin as to how to modify the code and where it needs to be placed within my php file to work correctly. Click the link below.

Display File Name

Please help
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros