0
我一直在這段代碼上工作,在功能上做出了我想要的功能,但最後我想我錯過了一些相當大的東西:這些文件似乎沒有上傳。進度條已經完美調整,對話框運行良好,只是沒有文件正在上傳。Plupload自定義配置問題,有什麼想法?
發生了什麼事?
我的javascript:
fileCount = 0;
barWidth = 0;
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'flash',
browse_button : 'pickfiles',
max_file_size : '10mb',
url : 'js/upload/upload.php',
resize : {width : 700, height : 700, quality : 90},
flash_swf_url : 'js/upload/plupload.flash.swf',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
]
});
uploader.bind('Init', function(up, params) {
});
uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
fileCount ++
$('#uploadfiles').fadeIn(200);
$('#filelist').append(
'<div id="' + file.id + '">' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
'</div>');
});
});
uploader.bind('FileUploaded', function(up, file) {
console.log(file.name);
$('#'+ file.id).fadeOut(200);
});
uploader.bind('UploadProgress', function(up, file) {
barWidth = barWidth+(file.percent/fileCount)
$('#progressBar').animate({"width":barWidth+"%"},300);
if (barWidth == 100) {$('#progressBox').delay(2000).fadeOut(200)};
});
$('#uploadfiles').click(function(e) {
e.preventDefault();
$('#filelist').fadeIn(200, function() {
$('#progressBox').fadeIn(200, function() {
uploader.start();
});
});
});
uploader.init();
});
我的HTML(每下面的評論更新):
<form method="post" action="js/upload/upload.php" enctype="multipart/form-data">
<div>
<button id="pickfiles" href="#">Add...</button>
<button id="uploadfiles" href="#">Upload</button>
<br />
<div id="filelist"></div>
<div id="progressBox"><div id="progressBar"></div></div>
</div>
</form>
更具體地說,我從Apache訪問日誌中看到這個:「POST /benjibee/js/upload/upload.php?name=DSC_1789%202.jpg HTTP/1.1」200 102 – Benji 2010-10-15 15:46:02
你能不能演示這個請示! – TechCare99 2013-04-22 12:20:32