英文:
how to get fileupload details on default laravel controller of register
问题
我从注册表单上传文件,但在注册控制器中没有获取到$_FILES
的详细信息。我想要temp_name
和文件名,但我只能获取到文件名。注册控制器以数组数据的形式获取值。
您能帮助解决这个问题吗?
$pathoffile = $_FILES['boxfile1']['tmp_name'];
$filename = $_FILES['boxfile1']['name'];
英文:
I upload file from register form, but I didn't get details of $_FILES
on register controller. I want temp_name
and filename I will get name of the file only. register controller get values as array data.
Can you please help with this issue.
$pathoffile=$_FILES['boxfile1']['tmp_name'];
$filename=$_FILES['boxfile1']['name'];
答案1
得分: 1
你需要设置表单属性 enctype="multipart/form-data"
在 Laravel 中,你可以通过以下方式实现:{{Form::open(array('url' => 'your_url', 'method' => 'post', 'files' => true))}}
参考链接:https://stackoverflow.com/questions/39344259/laravel-5-1-form-files-true
英文:
You need to set form attribute enctype="multipart/form-data"
In Laravel you can do this by {{Form::open(array('url' => 'your_url', 'method' => 'post', 'files' => true))}}
Reference: https://stackoverflow.com/questions/39344259/laravel-5-1-form-files-true
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论