これはBlueImpのjQuery-File-Uploadからのものです。
まず、ダウンロード:https ://github.com/blueimp/jQuery-File-Upload/archives/master
次に、jsフォルダーをアップロードします。
.htmlを作成します。
<html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload Example</title>
<style>
.bar {
height: 18px;
background: green;
}
</style>
</head>
<body>
<input id="fileupload" type="file" name="files[]" data-url="server/php/" multiple>
<div id="progress">
<div class="bar" style="width: 0%;"></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/vendor/jquery.ui.widget.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script>
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .bar').css(
'width',
progress + '%'
);
}
});
</script>
</body>
</html>
私はこれをテストしていませんが、機能する必要があります。そうでない場合はお知らせください。
オプション:の内容を<style></style>
.cssファイルに含めます。
オプション:.js<script src=""></script>
タグに.jsを含めます。
ソース:https ://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin