Yii2 \kato\DropZone file rename issue

元气小坏坏 提交于 2020-03-04 17:45:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!