By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

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

P: n/a
Don
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 =---
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Don wrote:
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...>.


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

Jul 17 '05 #2

P: n/a
Don wrote:
Is there some way to populate the "Browse" box for a <input type=file...>
with a default value?
Yes: the value attribute. But it's unreliable here; and
very rarely is it useful to suggest default file names.
I can do it for <input type=text...>, but can't seem to do it for <input
type=file...>.


Probably because your browser doesn't support it.

HAGS!

--
Jock
Jul 17 '05 #3

P: n/a
Don <no@adr.com> wrote:

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...>.


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, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #4

P: n/a
*** Tim Roberts escribió/wrote (Mon, 25 Oct 2004 23:49:57 -0700):
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.


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
--
Jul 17 '05 #5

P: n/a
Alvaro G. Vicario wrote:
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.


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
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.