在使用pluploader进行uploa时,我无法重命名文件。
我希望文件具有user-ID,post-ID和dateTime的命名。喜欢: u12_p983_20131103_192328.jpg
这是我现在的代码。
$(function() {
var
var uploader = new plupload.Uploader({
runtimes : 'html5,gears,flash,silverlight,browserplus',
browse_button : 'pickfiles',
container : 'container',
max_file_size : '10mb',
url : 'add_file_upload.asp?pID=<%=pID%>&userID=<%=CookieUserID%>',
flash_swf_url : 'includes/plupload.flash.swf',
silverlight_xap_url : 'includes/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
],
resize : {width : 600, quality : 90}
});
uploader.bind('Init', function(up, params) {
$('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
});
$('#uploadfiles').click(function(e) {
uploader.start();
e.preventDefault();
});
uploader.init();
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>');
});
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('UploadProgress', function(up, file) {
$('#' + file.id + " b").html(file.percent + "% <img height='10px' src='images/progress_bar.gif' />");
});
uploader.bind('Error', function(up, err) {
$('#filelist').append("<div>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</div>"
);
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('FileUploaded', function(up, file) {
$('#' + file.id + " b").html("100%");
});
});
我尝试过multipart_params
,但从来没有让它发挥作用。