循环上传图片

时间:2017-02-11 14:21:30

标签: php

我有以下表格

<form method="POST" action="{{url('/add-photo')}}" class="form-horizontal form-label-left" enctype="multipart/form-data" id="form-photo">
                   <input name="_token" type="hidden" value="{!! csrf_token() !!}" />


   <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Gallery Title<span class="required">*</span> </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                            <input id="gallery_title" name="gallery[0][photo_title]" class="form-control col-md-7 col-xs-12 album_name"  placeholder="Gallery Title" required="required" type="text">             
                            </div>
                                    <div class="col-md-3 col-sm-6 col-xs-12">
                            <button type="button" class="btn btn-primary" id="add_new_gallery">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true">
                            </span>add</button>

                        </div>
                            </div>
                    <div class="item form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Gallery Image<span class="required">*</span> </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                       <input type="file" id="input02 gallery_image" class="form-control gallery_image" name="gallery[0][photo_image]">
              </div>
            </div>     
                 <div class="item form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Gallery Description<span class="required">*</span> </label>
                <div class="col-md-6 col-sm-6 col-xs-12">

                    <textarea class="resizable_textarea form-control profile_address" id="profile_address" name="gallery[0][photo_description]" rows="8" placeholder="Tore text courtes"></textarea>   

                </div>
                </div>



          <div class="ln_solid"></div>
                              <div id="dynamic_gallery_data"></div>
          <div class="form-group">
            <div class="col-md-6 col-md-offset-3">
              <button type="submit" class="btn btn-primary">Cancel</button>
              <button id="submit-photo" type="submit" class="btn btn-success">Save</button>
            </div>
          </div>
        </form>
控制器中的

我打印了

 $gallery = $request->get('gallery');
  print_r($gallery);

我只获得标题和描述。

Array
(
    [0] => Array
        (
            [photo_title] => sfsafsa
            [photo_description] => asfa
        )

)

任何人都可以帮我解决如何在数组中获取文件名。因为我是动态表单字段

1 个答案:

答案 0 :(得分:1)

尝试:

.      2
.   c x + c x + c  = y
.    2     1     0