please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

FileUpload Element

Name

FileUpload Element---a file upload field for form input

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

form.name
form.elements[i]

Properties

form

A read-only reference to the Form object that contains the FileUpload element.

name

A read-only string, set by the HTML NAME attribute, that specifies the name of the FileUpload element. This is also the element_name that can be used to reference the FileUpload element as a property of its form.

type

A read-only string that specifies the type of this form element. For FileUpload elements, it has the value "file." Available in Navigator 3.0 and later.

value

A read-only string that specifies the value contained in the input field (which is also the value sent to the server when the form is submitted.) In Navigator 2.0, this field is always blank. In Navigator 3.0 any filename specified by the user may be read, but the property still may not be set.

Methods

blur()

Remove the keyboard focus from the FileUpload element.

focus()

Set the keyboard focus to the FileUpload element. When focus is set, all keystrokes are automatically entered into this element.

select()

Highlight all the text in the FileUpload element, and enter a special mode so that future input replaces the highlighted text.

Event Handlers

onblur()

Invoked when a user action causes the FileUpload element to lose the keyboard focus.

onchange()

Invoked when the user changes the value in the FileUpload element and moves the keyboard focus elsewhere. This event handler is not invoked for every keystroke in the FileUpload element, but only when the user completes an edit.

onfocus()

Invoked when a user action causes the FileUpload element to gain the keyboard focus.

HTML Syntax

A FileUpload element is created with a standard HTML <INPUT> tag, with the addition of optional attributes for event handlers:

<FORM ENCTYPE="multipart/form-data"
      METHOD=post>   required attributes
    ...
  <INPUT
    TYPE"file"  specifies that this is a FileUpload element
    [ NAME="name" ]   a name that can later be used to refer to this element
    specifies the name property
    [ SIZE=integer ]  how many characters wide the element is
    [ MAXLENGTH=integer ] max allowed number of input characters
    [ onBlur="handler" ]  the onblur() event handler
    [ onChange="handler" ]    the onchange() event handler
    [ onFocus="handler" ] the onfocus() event handler
  >
    ...

Description

The FileUpload element represents a file upload input element in a form. In many respects, this input element is much like the Text element. On the screen, it appears like a text input field, with the addition of a Browse... button that opens a directory browser. Entering a filename into a FileUpload element (either directly or through the browser) will cause Netscape to submit the contents of that file along with the form. For this to work, the form must use "multipart/form-data" encoding and the POST method.

The FileUpload element does not have a defaultValue property, and does not recognize the VALUE HTML attribute to specify an initial value for the input field. Similarly, the value property of the FileUpload element is read-only. Only the user may enter a filename; JavaScript may not enter text into the FileUpload field in any way. This is to prevent malicious JavaScript programs from uploading arbitrary files (such as password files) off of the user's machine.

See Also

"Element", "Form", "Text"


Previous Home Next
eval() Book Index FileUpload.blur()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/JAVA/SCRIPT/definitive/refp_119.htm, 9KB, , updated: 2019/10/14 15:00, local time: 2024/12/24 08:17,
TOP NEW HELP FIND: 
3.135.206.19:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/Techref/language/JAVA/SCRIPT/definitive/refp_119.htm"> [Chapter 21] Reference: FileUpload</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .