【问题标题】:Laravel - upload multiple filesLaravel - 上传多个文件
【发布时间】:2015-01-30 12:56:03
【问题描述】:

我正在寻找一些关于如何上传多个文件的教程,例如:http://tutsglobal.com/discussion/301/how-to-upload-multiple-images-in-laravel-4

有一个{{ Form::file('images[]', ['multiple' => true]) }} 行应该从输入中选择多个文件。但问题是我只能选择一个文件而不是更多。我该怎么做才能上传多个文件?


这是我的看法:

{{ Form::open(['action' => 'AdminController@postProject', 'files' => true, 'enctype' => 'multipart/form-data', 'class' => 'projectform']) }}

    {{ Form::file('images[]', ['multiple' => 'multiple']) }}

{{ Form::close() }}

这是 HTML 输出:

<input multiple="multiple" name="images[]" type="file">

我刚刚发现按住 SHIFT 键可以选择多个文件,但我希望能够一个一个地单独选择文件。

【问题讨论】:

  • 如果您的表单content-type 设置为multipart/form-data
  • 你能给我们看看表单的html输出吗?

标签: php forms file-upload laravel


【解决方案1】:

提示:也许它对你有帮助。

 <form action="demo_form.asp">
     Select images: <input type="file" name="img" multiple>
     <input type="submit">
 </form> 

【讨论】:

    猜你喜欢
    • 2019-09-30
    • 2020-08-04
    • 1970-01-01
    • 2015-09-30
    • 2021-05-13
    • 2021-05-25
    • 2013-08-14
    • 2018-07-16
    • 2013-08-13
    相关资源
    最近更新 更多