Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 22nd, 2003, 08:03 AM
Registered User
Join Date: Sep 2003
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?

Old September 22nd, 2003, 08:30 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

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

Consider the following example:
<body onload="document.Form1.submit();">
<form method="post" name="Form1">
<input type="file" value="C:\My Documents\MySecretFile.doc">
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.



Imar Spaanjaars
Everyone is unique, except for me.

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

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