Avatar of Joseph Longo
Joseph Longo
Flag for United States of America asked on

Display File Name - Input Type File

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;
}

Open in new window


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>

Open in new window


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
JScriptCSSHTMLJavaScriptjQuery

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes