使用“ upload_dir”选项时,Symfony 4“ Easy admin”上载目录不会更改

时间:2019-11-20 11:04:19

标签: php symfony4

我在Symfony 4.3中的捆绑easy_admin上遇到了一些麻烦

我找不到捆绑软件在何处定义上传目录。即使我在字段中定义了upload_dir选项,他仍然使用默认配置。

我的配置

easy_admin:
  entities:
    Images:
      new:
        fields:
          - { property: 'name', type: 'file_upload', upload_dir: 'uploads/images/', download_path: 'uploads/images/', allow_add: true, type_option: { multiple: true }}

错误消息

  

无效的上传目录   “ C:\ Users \ My \ Desktop \ Project / C:\ Users \ My \ Desktop \ Project / public / uploads / files / \”   它不存在或不可写。

谢谢您的帮助。

1 个答案:

答案 0 :(得分:3)

经过一番挣扎,我发现了

$('button[id^="buy_"]').click(function(){
        var div_data = $(this).attr('id').split('_'),
            reward = $('#reward_'+div_data[1]).text(),
            price = $('#price_'+div_data[1]).text(),
            currency = $('#currency_'+div_data[1]).text();
        submit_paypal(div_data[1], reward, price, currency);
    });
});

function submit_paypal(id, reward, price, currency){
    $.ajax({
        url: base_url+"ajax/paypal", 
        data: {process_paypal: id, reward: reward, price: price, currency: currency},
        success: function(data){ 
            if(data.error){
                alert(data.error);
            } 
            else{
                var form = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">';
                    form += '<input type="hidden" name="cmd" value="_xclick" />';
                    form += '<input type="hidden" name="business" value="'+data.email+'" />';
                    form += '<input type="hidden" name="item_name" value="Donate for '+$('title').text()+'" />';
                    form += '<input type="hidden" name="item_number" value="'+data.item+'" />';
                    form += '<input type="hidden" name="currency_code" value="'+currency+'" />';
                    form += '<input type="hidden" name="amount" value="'+price+'" />';
                    form += '<input type="hidden" name="no_shipping" value="1" />';
                    form += '<input type="hidden" name="return" value="'+base_url+'" />';
                    form += '<input type="hidden" name="cancel_return" value="'+base_url+'" />';
                    form += '<input type="hidden" name="notify_url" value="'+base_url+'payment/paypal" />';
                    form += '<input type="hidden" name="custom" value="'+data.user+'" />';
                    form += '<input type="hidden" name="no_note" value="1" />';
                    form += '<input type="hidden" name="tax" value="0.00" />';
                    form += '<input class="button" type="submit" value="Donate">';
                    form += '</form>';
                $(form).appendTo('body').submit();
            }
        }
    });
}

实际可行