Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 22nd, 2003, 08:03 AM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default File Field problem

An enquiry for a developer friend of mine (He has to go with Java functionality so this may not be relevent): He wants a File Field to have an initial value, also, he wants the user to select a folder rather than a file. Is this possible?

Reply With Quote
  #2 (permalink)  
Old September 22nd, 2003, 08:30 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Nope. The browser prohibits you from setting an initial value because it's inherently insecure.

Consider the following example:
Code:
<body onload="document.Form1.submit();">
<form method="post" name="Form1">
<input type="file" value="C:\My Documents\MySecretFile.doc">
</form>
</body>
As you can see from this example, allowing an initial value in a file control, would allow you to upload any file (if you know the name) from your visitor's computer by having the form automatically submit when the page loads.

You also can't select a folder; all you can do with the <input type="file"> control is allow a single file. There may be third party controls available for this, but personally I don't know one that can do this.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
file field tag sirup_segar HTML Code Clinic 0 May 26th, 2007 12:40 AM
How Do I Set Value For File Field surendran Javascript 1 April 4th, 2006 12:47 AM
How to store a file name in a field ? SKE Access ASP 6 May 14th, 2005 04:46 AM
File Field - How to browse for a file? shamigc Access 4 July 27th, 2004 01:13 PM
BLOB field file types kend SQL Server ASP 0 December 19th, 2003 02:45 PM



All times are GMT -4. The time now is 06:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.