I am trying to use http://valums.com/ajax-upload/ to upload files via AJAX. The reason why is because it meets my needs. However, I need to customize the behavior and I can t figure it out. According to the documentation, I should be able to use FileUploaderBasic, but I can t even get an upload button to appear with FileUploaderBasic. Currently, I m trying the following:
<div id="file-uploader">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
</noscript>
</div>
<div id="progressbar" style="width:300px;"></div>
<script type="text/javascript">
$().ready(function () {
var u = new uploader.FileUploaderBasic({
element: document.getElementById( file-uploader ),
action: /files/upload ,
debug: true,
onProgress: function (id, fileName, loaded, total) {
$("#progressbar").progressbar("value", 50);
},
onComplete: function(id, fileName, responseJSON){
$("#progressbar").progressbar("value", 100);
},
});
$("#progressbar").progressbar({
value: 0
});
});
</script>
对于正在上载的每份档案,我要显示进展棒的右边,我要显示已完成的上载体的百分比。 在进展栏下,我要显示档案名称和档案总尺寸。 我知道超文本是这样:
<table border= 0 cellpadding= 0 cellspacing= 0 >
<tr><td rowspan= 2 >[img]</td>
<td>[Progress Bar]</td>
<td>[%]</td>
</tr>
<tr><td colspan= 2 >[filename] - [filesize]</td></tr>
</table>
我不敢肯定如何用文件上载荷Basic来做到这一点。 我做了什么错误? 我到了绝望的地步。 请帮助!