Laravel将物理文件实例检索到输入文件中 [英] Laravel retrieve physical file instance onto input file

查看:74
本文介绍了Laravel将物理文件实例检索到输入文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检索物理文件并将其应用于输入文件字段.就像将$ file分配给它一样?在控制器的更新方法期间,由于它为空,因此它会不断触发请求验证错误.

is there a way to retrieve physical file and apply into the input file field. Like assigning the $file onto it? It appears during update method of my controller keeps triggering the request validation error because its empty.

{!! Form::file('doc_upload', $file, ['id' => 'doc_upload']) !!}

推荐答案

出于安全原因,浏览器不允许您预填充文件字段.

For security reasons, browsers do not let you prefill file fields.

浏览器禁止在文件输入时设置value属性 为安全起见,请键入,以便您在没有文件的情况下无法上传文件 用户选择了任何文件本身.

Browsers block against setting the value attribute on input of file type for security reasons so that you can't upload a file without the user's selected any file itself.

来源

这篇关于Laravel将物理文件实例检索到输入文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆