Solved

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

Posted on 2002-05-11
4
159 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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ouput in html in powershell 2 32
Text too large in Chrome 17 63
Ajax on ASP 2 41
How do I Import CSV File In my PHP Application 29 16
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 embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

733 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