title: Call to a member function getClientOriginalName() on array Laravel 5.2
body: <p>i have problems, i'm writing function to edit listings menu, when i try to update file image then i meet the error in getClientOriginalName()</p>
  
  <blockquote>
    <p>Call to a member function getClientOriginalName() on array</p>
  </blockquote>
  
  <pre><code> @foreach($edits as $key =&gt; $value)
      &lt;input type="hidden" value="{{ $key }}" name="key_edit[{{ $key }}]"&gt;
      &lt;div class="col-md-10"&gt;
          &lt;div class="col-md-6"&gt;                      
              &lt;div class="form-group"&gt;
                  &lt;label class="form-label" for="field-4"&gt;Tên menu&lt;/label&gt;
                      &lt;span class="desc"&gt;vd "Technology"&lt;/span&gt;
                      &lt;div class="controls"&gt;
                          &lt;input type="text" id="field-4" name="menu_title[{{ $key }}]" placeholder="Vui lòng điền tên" class="form-control" 
                          value="{{ $value-&gt;menu_title }}"&gt;
  
                          &lt;input type="hidden" id="field-4" name="id_menu[{{ $key }}]" placeholder="Vui lòng điền tên" class="form-control" 
                          value="{{ $value-&gt;menu_id }}"&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="col-md-6"&gt;
              &lt;div class="col-md-10 "&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label class="form-label" for="formfield10"&gt;Icon menu&lt;/label&gt;
                      &lt;span class="desc"&gt;vd. "character.jpg"&lt;/span&gt;
                      &lt;div class="controls"&gt;
                          &lt;input type="file" multiple="{{ $key }}" class="form-control" id="formfield10" name="upload_icon[{{ $key }}]"&gt;
  
                          &lt;input type="hidden" value="{{ $value-&gt;icon }}" name="icon_hidden[{{ $key }}]"&gt;  
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2"&gt;
          &lt;div class="col-md-1 btn-iconic"&gt;
                  &lt;div style="height:33px"&gt;&lt;/div&gt;
                  &lt;div class="controls"&gt;
                      &lt;button type="submit" class="btn btn-purple pull-right"&gt;&lt;i class="fa fa-edit "&gt;&lt;/i&gt;&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-1 btn-iconic"&gt;
                  &lt;div style="height:33px"&gt;&lt;/div&gt;
                  &lt;div class="controls"&gt;
                      &lt;button type="submit" class="btn btn-purple"&gt;&lt;i class="fa fa-close "&gt;&lt;/i&gt;&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
      &lt;/div&gt;
      @endforeach
  
      &lt;/form&gt;
  </code></pre>
  
  <p>MenuController</p>
  
  <pre><code>public function edit(Request $request){
              $input= $request-&gt;all();
              $edit = DB::table('categorys')-&gt;get();
  
              if($request-&gt;hasFile('upload_icon')) {
                  $file = $input['upload_icon'];
                  $name = $file-&gt;getClientOriginalName();
                  $file-&gt;move(public_path().'/images/menu', $name);
  
                  $id= $request-&gt;input('id_menu');
                  $name = $request-&gt;input('menu_title');
                  $icon= $name;
                  foreach ($edit as $key =&gt; $value) {
                      DB::table('categorys')-&gt;where('menu_id', $id)-&gt;update([
                          'menu_id'=&gt; $id[$key],
                          'menu_title' =&gt; $name[$key], 
                          'icon' =&gt; $icon[$key]
                      ]);
  
                  }
  
              }
              else{               
  
                  $id= $request-&gt;input('id_menu');
                  $name = $request-&gt;input('menu_title');
                  $icon= $request-&gt;input('icon_hidden');
  
                  $key =$request-&gt;input('key_edit');
                  foreach ($edit as $key =&gt; $value) {
                      DB::table('categorys')-&gt;where('menu_id', $id)-&gt;update([
                          'menu_id'=&gt; $id[$key],
                          'menu_title' =&gt; $name[$key], 
                          'icon' =&gt; $icon[$key]
                      ]);
  
                  }
  
              }
              return View('admin.menu.edit')-&gt;with('edits',$edit);
          }
  </code></pre>
  
  <p>dd($input['upload_icon']);</p>
  
  <pre><code>array:2 [▼
    0 =&gt; UploadedFile {#161 ▼
      -test: false
      -originalName: "life_icon_post.png"
      -mimeType: "image/png"
      -size: 344
      -error: 0
      path: "E:\xampp\tmp"
      filename: "phpB451.tmp"
      basename: "phpB451.tmp"
      pathname: "E:\xampp\tmp\phpB451.tmp"
      extension: "tmp"
      realPath: "E:\xampp\tmp\phpB451.tmp"
      aTime: 2016-05-20 10:40:16
      mTime: 2016-05-20 10:40:16
      cTime: 2016-05-20 10:40:16
      inode: 0
      size: 344
      perms: 0100666
      owner: 0
      group: 0
      type: "file"
      writable: true
      readable: true
      executable: false
      file: true
      dir: false
      link: false
      linkTarget: "E:\xampp\tmp\phpB451.tmp"
    }
    1 =&gt; null
  ]
  </code></pre>