JavaScript/Working With Files
Previous: Handling XML Index Next: JScript in Microsoft WSH

With pure HTML4 and pure JavaScript, there's really only one thing you can do with the users files:

The server sends a Web page that includes a form something like this:[1]

<form action="/upload_handler" method="post">
  <input type="file" />

and then, the browser allows the user to select one file, and the browser uploads it -- without any JavaScript on the client being able to see any of that data or cancel the transmission or even show a progress bar.

If you want JavaScript to know anything about the file before it is transmitted (for example, to immediately cancel the transmission of a large file rather than wait an hour for the file to be transmitted, then tell the user "File too large"; or to show a progress bar), you'll have to use something other than pure JavaScript on pure HTML4.

Some popular options are:[2][3][4][5]

  • use a modern Web browser that supports the HTML5 File API.
  • use Flash (perhaps a tiny flash utility like Gmail uses to draw a little progress bar)
  • use a Java applet
  • use an ActiveX control


Previous: Handling XML Index Next: JScript in Microsoft WSH

  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.


Manage research, learning and skills at IT1me. Create an account using LinkedIn to manage and organize your IT knowledge. IT1me works like a shopping cart for information -- helping you to save, discuss and share.

  Contact Us  |  About |  IT Training & References |  IT Careers |  IT Hardware |  IT Software |  IT Books