我正在使用VichUploaderBundle和Symfony 3.4.4,一切正常 . 现在我想在下载链接旁边显示FileName,MimeType和File-Size
_ download _(TheFile.pdf,application / pdf,26407)
因为我已经复制了原来的fields.html.twig
./vender/vich/uploader-bundle/Ressources/views/Form/
to ./templates/bundles/VichUploaderBundle/Form/
但现在我仍然坚持如何访问fileName,fileSize-和mimeType-Fields:
...
{% if download_uri %}
<a href="{{ download_uri }}">{{ translation_domain is same as(false) ? download_label : download_label|trans({}, translation_domain) }}</a> ( {{ ???.fileName.vars.value }}, {{ ???.fileMimeType.vars.value }}, {{ ???.fileSize.vars.value }})
{% endif %}
我已经尝试过:
- "form.fileName" - 结果:
属性“fileName”和方法“fileName()”,“fileName()”/“isfileName()”/“hasfileName()”或“__call()”都不存在,并且在“Symfony”类中具有公共访问权限\分量\表格\ FormView控件” .
- "entity.fileName" - 结果:
变量“实体”不存在 .
- "form.entity.fileName" - 结果:
属性“实体”和方法“entity()”,“getentity()”/“isentity()”/“hasentity()”或“__call()”都不存在,并且在“Symfony”类中具有公共访问权限\分量\表格\ FormView控件 “”
实际表单的相关部分如下所示:
...
{{ form_start(form) }}
...
{{ form_widget(form.theFile, {'attr': {'class': 'form-control'}}) }}
...
{{ form_end(form) }}
任何提示?请帮忙
非常感谢...