Working With Files

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" />
</form>

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

References



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

JavaScript/Working_with_files
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultlogic.com. Create an account using LinkedIn to manage and organize your omni-channel knowledge. defaultlogic.com is like a shopping cart for information -- helping you to save, discuss and share.


  Contact Us