我正在尝试使用symfony2的php upload_progress功能。我在php.ini中设置了session.upload_progress.prefix和session.upload_progress.name。 我的表格如下:
<form id="form-import-file" action="" method="post" {{ form_enctype(form) }} class="form-horizontal">
{{ form_widget(form.file, { 'attr':{'class':'input-file-import'}}) }}
{{ form_rest(form) }}
{{ form_errors(form.file) }}
<input type="hidden" name="{{ upload_progress_name }}" value="123" />
<button type="submit" class="btn btn-success">Submit</button>
</form>
其中upload_progress_name = ini_get(“session.upload_progress.name”)。
上传没问题,但会话没有显示任何上传信息。 有什么帮助吗?
答案 0 :(得分:0)
Ensure that <input type="hidden" name="{{ upload_progress_name }}" value="123" />
is before the file input fields. Just place it under the form tag.
Also what helped me out is this list: issues on php upload progress
Finally there is good symfony2-bundle, which may help you to not reinvent everything new.OneUpBundle With this bundle you can pick a Frontend solution or create your own one.