Skip to content

Instantly share code, notes, and snippets.

@MCF
Created February 8, 2011 02:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MCF/815706 to your computer and use it in GitHub Desktop.
Save MCF/815706 to your computer and use it in GitHub Desktop.
Very Basic plupload test
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The most "basic" plupload test</title>
<!-- Load source versions of the plupload script files -->
<script type="text/javascript" src="plupload.js"></script>
<script type="text/javascript" src="plupload.html4.js"></script>
<script type="text/javascript">
window.setTimeout(function() {
var pluploader = new plupload.Uploader({
runtimes : 'html4',
browse_button : 'uploadfiles_id',
container: 'uploadfiles_id',
max_file_size : '10mb',
url : '/file_upload'
});
pluploader.bind('Init', function(up, params) {
console.log("Current runtime environment: " + params.runtime);
});
pluploader.init();
pluploader.bind('FilesAdded', function(up, files) {
console.log("Starting upload.");
up.refresh();
up.start();
});
pluploader.bind('UploadProgress', function(up, file) {
console.log("Progress: " + file.name + " -> " + file.percent);
});
pluploader.bind('Error', function(up, err) {
console.log("Error: " + err.code + ", Message: " + err.message +
(err.file ? ", File: " + err.file.name : ""));
});
pluploader.bind('FileUploaded', function(up, file, response) {
console.log("File uploaded, File: " + file.name + ", Response: " + response.response);
});
}, 1);
</script>
</head>
<body style="">
<div id="uploadfiles_id" style="width:100px; background-color:red">
<p>Upload</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment