How to populate <input type=file...> with default value?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don

    How to populate <input type=file...> with default value?

    Is there some way to populate the "Browse" box for a <input type=file...> with a default value? I
    can do it for <input type=text...>, but can't seem to do it for <input type=file...>.

    Any ideas?

    Thanks,
    Don


    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
  • Janwillem Borleffs

    #2
    Re: How to populate &lt;input type=file...&gt ; with default value?

    Don wrote:[color=blue]
    > Is there some way to populate the "Browse" box for a <input
    > type=file...> with a default value? I can do it for <input
    > type=text...>, but can't seem to do it for <input type=file...>.
    >[/color]

    Stop multi-posting! Already answered in alt.php and alt.comp.lang.p hp


    JW



    Comment

    • John Dunlop

      #3
      Re: How to populate &lt;input type=file...&gt ; with default value?

      Don wrote:
      [color=blue]
      > Is there some way to populate the "Browse" box for a <input type=file...>
      > with a default value?[/color]

      Yes: the value attribute. But it's unreliable here; and
      very rarely is it useful to suggest default file names.
      [color=blue]
      > I can do it for <input type=text...>, but can't seem to do it for <input
      > type=file...>.[/color]

      Probably because your browser doesn't support it.

      HAGS!

      --
      Jock

      Comment

      • Tim Roberts

        #4
        Re: How to populate &lt;input type=file...&gt ; with default value?

        Don <no@adr.com> wrote:[color=blue]
        >
        >Is there some way to populate the "Browse" box for a <input type=file...> with a default value? I
        >can do it for <input type=text...>, but can't seem to do it for <input type=file...>.[/color]

        No. It is a security risk. You aren't allowed to force a file to be
        downloaded without specific action on the part of the user. By
        pre-populating a file control and triggering a "submit", you could suck up
        a file from the user's hard disk without his knowledge.
        --
        - Tim Roberts, timr@probo.com
        Providenza & Boekelheide, Inc.

        Comment

        • Alvaro G. Vicario

          #5
          Re: How to populate &lt;input type=file...&gt ; with default value?

          *** Tim Roberts escribió/wrote (Mon, 25 Oct 2004 23:49:57 -0700):[color=blue]
          > No. It is a security risk. You aren't allowed to force a file to be
          > downloaded without specific action on the part of the user. By
          > pre-populating a file control and triggering a "submit", you could suck up
          > a file from the user's hard disk without his knowledge.[/color]

          I've heard there's a browser (Opera?) that allows webmasters to prefill the
          field and then prompts the user whether the file must be uploaded.

          Of course, users normally click on everything they're shown :)


          --
          -+ Álvaro G. Vicario - Burgos, Spain
          +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
          ++ Las dudas informáticas recibidas por correo irán directas a la papelera
          -+ I'm not a free help desk, please don't e-mail me your questions
          --

          Comment

          • John Dunlop

            #6
            Re: How to populate &lt;input type=file...&gt ; with default value?

            Alvaro G. Vicario wrote:
            [color=blue]
            > I've heard there's a browser (Opera?) that allows webmasters to prefill the
            > field and then prompts the user whether the file must be uploaded.[/color]

            Your source was right. Opera has reportedly* been
            supporting initial file names since version 3.60; my v. 7.10
            does. Unsurprisingly, Lynx does too.


            * http://www.cs.tut.fi/~jkorpela/forms/file.html#value

            Slainte!

            --
            Jock

            Comment

            Working...