问题
I have created a dropzone in yii2 to upload images to server my dropzone widget is
<?=\kato\DropZone::widget([
'options' => [
'url'=>'index.php?r=site/upload',
'maxFilesize' => '2',
'addRemoveLinks'=>true,
'renameFile'=>"function (filename) {
return new Date().getTime() + '_' + filename;
}"
// 'autoProcessQueue'=>false
],
'clientEvents' => [
'complete' => "function(file){console.log(file)}",
'removedfile' => "function(file){alert(file.name + ' is removed')}"
],
]);?>
I want a unique name for the file.So that i want to rename the file before upload. I tried
'renameFile'=>"function (filename) {
return new Date().getTime() + '_' + filename;
}"
But it is not working.How can i fix this
来源:https://stackoverflow.com/questions/60349738/yii2-kato-dropzone-file-rename-issue