Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Don
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

re: How to populate <input type=file...> 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.php


JW



John Dunlop
Guest
 
Posts: n/a
#3: Jul 17 '05

re: How to populate <input type=file...> 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
Tim Roberts
Guest
 
Posts: n/a
#4: Jul 17 '05

re: How to populate <input type=file...> 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.
Alvaro G. Vicario
Guest
 
Posts: n/a
#5: Jul 17 '05

re: How to populate <input type=file...> 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
--
John Dunlop
Guest
 
Posts: n/a
#6: Jul 17 '05

re: How to populate <input type=file...> 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
Closed Thread