photomix/public/javascripts/plupload/examples/custom.html
2011-04-11 12:43:27 +08:00

91 lines
3.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="css/plupload.queue.css" type="text/css" media="screen" />
<title>Plupload - Queue widget example</title>
<style type="text/css">
body {background: #9A7C5F;}
</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
</script>
<script type="text/javascript" src="../js/gears_init.js"></script>
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<!-- Load source versions of the plupload script files -->
<script type="text/javascript" src="../src/javascript/plupload.js"></script>
<script type="text/javascript" src="../src/javascript/plupload.gears.js"></script>
<script type="text/javascript" src="../src/javascript/plupload.silverlight.js"></script>
<script type="text/javascript" src="../src/javascript/plupload.flash.js"></script>
<script type="text/javascript" src="../src/javascript/plupload.browserplus.js"></script>
<script type="text/javascript" src="../src/javascript/plupload.html5.js"></script>
<script type="text/javascript" src="../src/javascript/jquery.plupload.queue.js"></script>
<script>
// Custom example logic
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'pickfiles',
max_file_size : '10mb',
url : 'upload.php',
resize : {width : 320, height : 240, quality : 90},
flash_swf_url : '../js/plupload.flash.swf',
silverlight_xap_url : '../js/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
});
uploader.bind('Init', function(up, params) {
$('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
});
uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
$('#filelist').append(
'<div id="' + file.id + '">' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
'</div>');
});
});
uploader.bind('UploadFile', function(up, file) {
$('<input type="hidden" name="file-' + file.id + '" value="' + file.name + '" />')
.appendTo('#submit-form');
});
uploader.bind('UploadProgress', function(up, file) {
$('#' + file.id + " b").html(file.percent + "%");
});
$('#uploadfiles').click(function(e) {
uploader.start();
e.preventDefault();
});
uploader.init();
});
</script>
<!-- <script type="text/javascript" src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script> -->
</head>
<body>
<form id="submit-form" method="post" action="dump.php">
<h1>Custom example</h1>
<p>Shows you how to use the core plupload API.</p>
<div>
<div id="filelist">No runtime found.</div>
<br />
<a id="pickfiles" href="#">[Select files]</a>
<a id="uploadfiles" href="#">[Upload files]</a>
</div>
<input type="submit" />
</form>
</body>
</html>