RE: Text Box Size, List Box Size & File Object anomalies.

by Masaoud Moonim <masutm(at)yahoo.com>

 Date:  Tue, 11 Apr 2000 03:58:37 -0700 (PDT)
 To:  hwg-graphics(at)hwg.org
  todo: View Thread, Original


Hi Susan

Actually the "File" object i was mentioning is a
standard HTML feature.

> I need to create a form that will allow the user to
> pick a file off their drive and then it will open in
> the browser.  It looks like your file object might 
> do that.
> 
> Any ideas for me on how to do it?

Here is some code which uses a bit of javascript to do
the needful ( Call the file below "test.html" ):
---------------------------------------------------

<HTML>

<HEAD>
<SCRIPT LANGUAGE="Javascript">

function ViewFile() {
  var filename = document.ViewFileForm.FileName.value;
  if( ( filename != null ) && ( filename != "" ) ) {
     // change the current pages url attribute to the
     // value specified in the file object
     window.location.href = "file://" + filename;
  } else {
     alert( "Select a valid file name first ...!" );
  }
}

</SCRIPT>
</HEAD>
<BODY>
Select a local file using the "Browse..." Button or
type in a URL and click on the "View" Button
<br>
<FORM NAME="ViewFileForm" METHOD="POST"
ACTION="test.html">
<Input type="FILE" Name="FileName">
<br><br>
<Input type="Button" Value="View"
onClick="ViewFile()">
</FORM>

</BODY>
</HTML>

----------------------------------------------------

Hope it helped ! ;-)

Regards
Masaoud

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

HWG: hwg-graphics mailing list archives, maintained by Webmasters @ IWA