0
所以基本上,我想用var allowablefile
覆蓋當前的maxFileSize
。但是,在控制檯中發送了正確的allowablefile值,但是當該值被覆蓋時,該值仍然是500,這是我首先聲明的值。我究竟做錯了什麼?這是整個腳本。變量傳遞未被jQuery覆蓋
<script>
$(document).ready(function() {
var allowablefile = "500";
$.get("size.php", function(datas) {
var currfile = datas;
var rtplan = '<?php echo $rtplan; ?>';
if (rtplan == "standard") {
var maxfile = "40000000";
allowablefile = maxfile - currfile;
}
else if (rtplan == "pro") {
var maxfile = "110000000";
allowablefile = maxfile - currfile;
}
else if (rtplan == "turbo") {
var maxfile = "60000000";
allowablefile = maxfile - currfile;
}
console.log(allowablefile);
});
var allw = allowablefile.toString();
var settings = {
url: "../upload.php",
method: "POST",
fileName: "myfile",
multiple: true,
maxFileSize: allw,
uploadButtonClass:"btn btn-primary btn-block pull-right",
onSuccess:function(files,data,xhr)
{
$("#status").html('<span class="label label-success">File uploaded</span>').fadeIn("slow");
$("#status").fadeOut(7000);
},
onError: function(files,status,errMsg)
{
$("#status").html('<span class="label label-danger">File upload failed</span>').fadeIn("slow");
$("#status").fadeOut(7000);
}
}
$("#mulitplefileuploader").uploadFile(settings);
});
</script>
我試圖在一個div的name
值聲明價值,但仍然沒有工作。乾杯。