Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 August 18th, 2004, 02:04 AM
Authorized User
Join Date: Nov 2003
Location: Phoenix, AZ, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default defining location for input type file

I'm not sure this is the right forum to ask this question but this is what I'm trying to do:

I have a form with a input element, type file. What I want to happen when a user clicks the Browse button to go get a file is for the "Choose File" dialog to open to a specified location defined by the script. For instance:

<input name="Pic" type="file" onClick="getPic()">

in head...
function getPic() {
  myElement = document.form.Pic;
  path = "ftp://ftpsite/pictures/";
  myElement.value = path;

Is it possible to do this? If so, does anyone know how to achieve it?


Old August 24th, 2004, 08:15 AM
Authorized User
Join Date: Aug 2004
Location: Chicago, IL, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

The 'value' attribute of the file input box is disabled in IE and Netscape for security reasons. Without that, there's no way to use javascript to open the "Choose File" dialog in a specified location.

Similar Threads
Thread Thread Starter Forum Replies Last Post
input type="file" grstad Classic ASP Basics 24 January 31st, 2007 07:28 PM
INPUT type=file (Urget Help) surendran PHP How-To 1 April 9th, 2006 12:42 PM
input type file darkhalf Javascript 1 October 29th, 2005 02:17 AM
define location for file input tag bleitner Javascript 6 August 21st, 2004 09:47 AM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM

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