Home > Uncategorized > Javascript file handling

Javascript file handling

The FileReader object is a new feature of HTML5, and it allows handling of file-data on the client side of a web-application, so for instance, you could provide extra validation on an uploaded file before sending it to the server. 

Here’s a simple example of it’s use:

<script src=”http://code.jquery.com/jquery-1.11.0.min.js”></script&gt;
<script language=”javascript”>
function init()
console.log(“Good to go!”);
function myFile_change(evt)
var f = evt.target.files[0];
reader = new FileReader();
reader.onload = function(e) {
<input type=”file” id=”myFile”>
<img id=”imgUpload”>

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: