<input type="file">

Last post 10-24-2007 5:56 PM by yvzman. 2 replies.

Sort Posts:

  • <input type="file">

    10-24-2007, 3:12 PM
    • Member
      24 point Member
    • Paarul
    • Member since 01-30-2007, 9:39 PM
    • Posts 138

    Hi All

     I am using <Input type="file"> button which allows users to upload a file. I want a link button to do the same thing i.e. allowing users to upload a doc.Is there a way to do it?

    I've looked into this artical

    http://www.quirksmode.org/dom/inputfile.html ,I don't want any image but a separate link button to carry out the same functionality.

     Thanks,

    Paarul

  • Re: <input type="file">

    10-24-2007, 5:37 PM
    Answer
    • Contributor
      4,567 point Contributor
    • RTernier
    • Member since 06-05-2003, 1:40 AM
    • British Columbia, Canada
    • Posts 1,096

     Sometimes with webdesign you need to use 2 controls to do 1 thing at times. The regular <input type="file" is very standard and you can't really do anything abotu it.


    The Killer Ninja Coding Monkeys thank those that mark helpful posts as answers.

    My Site | My Examples | My Blog


  • Re: <input type="file">

    10-24-2007, 5:56 PM
    Answer
    • Member
      152 point Member
    • yvzman
    • Member since 05-07-2007, 3:35 PM
    • Turkey
    • Posts 36

     Try this.

    If one does not exist add a css file to yor project and add the following css code to that;

    div.fileinputs {
        position: relative;
    }

    div.fakefile {
        position: absolute; top: 0px; left: 0px; z-index: 1;
    }

    input.file {
        position: relative; text-align: right; -moz-opacity:0 ; filter:alpha(opacity: 0); opacity: 0;  z-index: 2;
    }

     

    now this is your fileupload control with link button; html:

     <div class="fileinputs">
                <input type="file" class="file" />
                <div class="fakefile">
                    <input />
                    <a href="">Upload File</a>
                </div>
     </div>

     as you see i have added anchor(a) a tag instead of a linkbutton since they will have both same apperance.but if you want you can change

    <a href="">Upload File</a> with

    <asp:LinkButton ID="fff" runat="server" Text="Upload File"></asp:LinkButton>.

     

    do not forget to add  css reference in you page as

    <head>..... 

    <link href="StyleSheet1.css" rel="stylesheet" type="text/css" /> 

    .....</head>

     

    Resource is http://www.quirksmode.org/dom/inputfile.html

    Yavuz Küçükpetek
    http://www.dotnetgurus.net
Page 1 of 1 (3 items)