?
Solved

set a value to a <input type="file"> field

Posted on 2002-05-11
4
Medium Priority
?
165 Views
Last Modified: 2010-04-09
Is there a way to set a value (in this case descriptive text) to a form field <input type="file">?

/joergen

0
Comment
Question by:jastroem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 150 total points
ID: 7003017
<label accesskey=C><input type="file" name="uploaded"> Descriptive text</label>

It is not possible to place text inside the form field, for security reasons. The closest I can think that would do it (and I do not consider this a good solution, it breaks to easily) would be to use CSS to position a <div> on top of the field, and then set the div to display: none and set the focus to the input when the div had its onclick, or the form field had its onfocus event triggered.
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7004005
please clarify...

do you want some descriptive text or do you want a certain file to be already in the field when the page is loaded.

the second case is not possible.

for the first, there are many workarounds...what dorward told you is one, you can also have a tooltip or a stutusbar message <-- BAD!

0
 
LVL 33

Expert Comment

by:hongjun
ID: 7004115
This is being asked umpteen times. There's no way to put text in a input type=file

hongjun
0
 

Author Comment

by:jastroem
ID: 7004342
Thanks a lot for the information.

I understand the teh security issue - unfortunately there are some cases where it could be really goog to place a previous uploaded file in the file field... like in this case where a record is updated.

I have solved the problem in another - less nice - way.

/ joergen
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question