473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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

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
5 20453
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
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
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
*** 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bhavin | last post by:
Hi I'm trying to input image file using this synax. <input type=file name="tx_file" accept="image/*" class=boxText> But when open file dialouge appears, it shows all the file and user can select...
0
by: Reza | last post by:
Hello I have a html control, <input type= file ...> and 1. I want the user to select files always from a set location but not sure how or even is this possible 2. If it is possible, can it set...
1
by: myahact | last post by:
Hello, I have <input type=file id=myfile> in a form. In IE I can read the value thusly: document.getElementById("myfile").value But thusly returns "" in Mozilla/Netscape. I also tried...
1
by: Axe | last post by:
Here's the problem: I've got an ASP.NET (C#) web page that has a single <input type=file> control on it for uploading a file. The way the code works is that the uploaded file is then parsed for...
2
by: Evgeny Zoldin | last post by:
Hi ALL. I need to simulate send POST data ( - file upload) as it was submitted in Browser. In C# I create instanse of IE, navigate to page with the form, fill in the fields and try to Submit by...
6
by: reiyel | last post by:
hiya all i would like to ask some help for a little javascript, here's my problem: i have a html page with a <input type="file"> box, problem is i don't want the user to be able to write on the...
4
by: SammyBar | last post by:
Hi all, I wonder is it possible to upload the content of an <imgfield to a server. The content of the <imgwas downloaded from a web site different from the one it should be uploaded. The image...
1
by: mishrarajesh44 | last post by:
hi all, i am writting a program to update the record in the mysql databqse, using php. I hav designed the 'update form' totally same as my 'add form' so that by entering the mobile no. of...
5
by: magix | last post by:
Hi, with: <Input type="file"...> it will let the user to click to "browse" button to browse for files, question is how can I limit the file type to be only jpg and gif extension, when the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.