Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now