Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Feb 2008
    Posts
    212
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How can I add an image to an input id="file" ?

    I'm using an Upload Form and I believe this line of code, shown below, is what the attached image shows (see attached image).

    How can I add a different image button to replace the "Choose File" button that's currently there?

    Also, how can I put some space between the Choose File button and the "No File Chosen" function?

    Thanks

    Code:
    <div class='controls'>
    <input id="file" type="file" name="file" />
    <?php //echo form_error('file');   ?></div>
    Attached Thumbnails Attached Thumbnails How can I add an image to an input id=&quot;file&quot; ?-choosefile1.png  

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    How <input type="file"> looks is totally different in different browsers.

    Some browsers only display a button for this input while others display an input text field with the button.

    The only way to style it is to hide it completely and substitute what you want the client to see in its place.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Regular Coder
    Join Date
    Feb 2008
    Posts
    212
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks for that great bit of information.
    If anyone would like to help me "hide it and substitute it" I'd appreciate any assistance.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,866
    Thanks
    6
    Thanked 1,029 Times in 1,002 Posts

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •