title: got 302 on form update in laravel
body: <p>I am facing a 302 redirect issue while posting data in for updating everything updated successfully except image where i get 302 and my page redirected.</p>
  
  <p>here is my form blade code :</p>
  
  <pre><code>{!! Form::model($post, ['method' =&gt; 'PATCH','route' =&gt; ['posts.update', $post-&gt;id],'data-parsley-validate' =&gt; '','class' =&gt; 'form-horizontal','files'=&gt;true,'name'=&gt;'updateabout']) !!}
  
  &lt;div class="col-md-8"&gt;
  
      &lt;input type="hidden" name="csrf_test_name" value="{!! csrf_token() !!}"&gt;
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt; Title : &lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input class="form-control " name="title" type="text" value="{{$post-&gt;title}}" id="title"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Slug:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input class="form-control" name="slug" type="text" value="{{$post-&gt;slug}}" id="slug"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Category:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::select('category_id', $categories, null, ['class' =&gt; 'form-control']) }}
  
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Tags:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::select('tags[]', $tags, null, ['class' =&gt; 'form-control select2-multi', 'multiple' =&gt; 'multiple']) }}
          &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Short-Description:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;textarea name="short_description" class="form-control" maxlength="140" rows="7" required
                        id="shortdesc"&gt;{{$post-&gt;short_description}}&lt;/textarea&gt;
              &lt;script src="{{ asset("/public/admin/ckeditor/ckeditor.js") }}"&gt;&lt;/script&gt;
              &lt;script&gt;
                  CKEDITOR.replace('shortdesc', {
                      height: 100,
                      toolbar: 'Custom', //makes all editors use this toolbar
                      toolbarStartupExpanded: false,
                      toolbarCanCollapse: false,
                      toolbar_Custom: [] //define an empty array or whatever buttons you want.
                  });
              &lt;/script&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Date:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::text('date', null, ['class' =&gt; 'form-control','id'=&gt;'date']) }}
          &lt;/div&gt;
          &lt;script type="text/javascript"&gt;
              $(document).ready(function () {
                  $(function () {
                      $('#date').datepicker({format: 'HH:mm:ss'});
                  })
              });
          &lt;/script&gt;
      &lt;/div&gt;
  
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt; Image: &lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;img src="{{asset($post-&gt;image)}}" height="200" width="579"&gt;
              &lt;input type="hidden" name="imageold" value="{{$post-&gt;image}}"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Change Image: &lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input type="file" name="imagemain" id="file"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Description:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::textarea('description', null, ['class' =&gt; 'form-control','id'=&gt;'long_description']) }}
              &lt;script src="//cdn.tinymce.com/4/tinymce.min.js"&gt;&lt;/script&gt;
              &lt;script&gt;
                  tinymce.init({
                      selector: '#long_description',
                      convert_urls: false,
                      statusbar: false,
                      height: '300',
                      plugins: 'image code print preview fullpage  searchreplace autolink directionality  visualblocks visualchars fullscreen image link    table charmap hr pagebreak nonbreaking  toc insertdatetime advlist lists textcolor wordcount   imagetools    contextmenu colorpicker textpattern media ',
                      toolbar: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify  | numlist bullist outdent indent  | removeformat |undo redo | image code| link fontsizeselect  | ',
  
                      image_title: true,
                      automatic_uploads: true,
                      images_upload_url: '{{url("/admin/upload")}}',
                      file_picker_types: 'image',
                      file_picker_callback: function (cb, value, meta) {
  
                          var input = document.createElement('input');
                          input.setAttribute('type', 'file');
                          input.setAttribute('accept', 'image/*');
  
                          input.onchange = function () {
                              var file = this.files[0];
  
                              var reader = new FileReader();
                              reader.readAsDataURL(file);
                              reader.onload = function () {
                                  var id = 'blobid' + (new Date()).getTime();
                                  var blobCache = tinymce.activeEditor.editorUpload.blobCache;
                                  var base64 = reader.result.split(',')[1];
                                  var blobInfo = blobCache.create(id, file, base64);
                                  blobCache.add(blobInfo);
                                  cb(blobInfo.blobUri(), {title: file.name});
                              };
                          };
                          input.click();
                      }
                  });
              &lt;/script&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Meta-title:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::textarea('meta_title', null, ['class' =&gt; 'form-control','id'=&gt;'meta-title']) }}
              &lt;script&gt;
                  CKEDITOR.replace('meta-title', {
                      height: 100,
                      toolbar: 'Custom', //makes all editors use this toolbar
                      toolbarStartupExpanded: false,
                      toolbarCanCollapse: false,
                      toolbar_Custom: [] //define an empty array or whatever buttons you want.
                  });
              &lt;/script&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Meta-Keywords:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::textarea('meta_keywords', null, ['class' =&gt; 'form-control','id'=&gt;'meta-keywords']) }}
              &lt;script src="{{ asset("/public/admin/ckeditor/ckeditor.js") }}"&gt;&lt;/script&gt;
              &lt;script&gt;
                  CKEDITOR.replace('meta-keywords', {
                      height: 100,
                      toolbar: 'Custom', //makes all editors use this toolbar
                      toolbarStartupExpanded: false,
                      toolbarCanCollapse: false,
                      toolbar_Custom: [] //define an empty array or whatever buttons you want.
                  });
              &lt;/script&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label class="col-md-2 control-label"&gt;Posted By:&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              {{ Form::text('authorname', null, ['class' =&gt; 'form-control']) }}
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;hr&gt;
  
      &lt;br&gt;
  
      &lt;div class="form-group row"&gt;
          &lt;div class="col-sm-offset-3 col-sm-6"&gt;
              {{ Form::submit('Update Post', array('class' =&gt; 'btn btn-success')) }}
              &lt;a type="button" id="addslide" class="btn btn-danger"&gt;Cancel&lt;/a&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
  {!! Form::close() !!} 
  </code></pre>
  
  <p>and My controller:</p>
  
  <pre><code>public function update(Request $request, $id)
  {
      // Validate the data
      $postdata = Post::find($id);
  
      //print_r($post);
  
      if ($request-&gt;input('slug') == $postdata-&gt;slug) {
          //echo 'slug match';
          //exit();
          $this-&gt;validate($request, [
              'title'            =&gt; 'required|max:255',
              'category_id'      =&gt; 'required|integer',
              'long_description' =&gt; 'required',
          ]);
      } else {
          //echo 'new slug matching';
          //exit();
          $this-&gt;validate($request, [
              'title'            =&gt; 'required|max:255',
              'slug'             =&gt; 'required|alpha_dash|min:5|max:255|unique:posts,slug',
              'category_id'      =&gt; 'required|integer',
              'long_description' =&gt; 'required',
          ]);
      }
  
      if ($request-&gt;hasFile('imagemain')) {
  
          //echo 'request has old file to unlink ';
          // exit();
          //unlink($request-&gt;get('image'));
          // Get filename with the extension
          $filenameWithExt = $request-&gt;file('imagemain')-&gt;getClientOriginalName();
          // Get just filename
          $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
          // Get just ext
          $extension = $request-&gt;file('imagemain')-&gt;getClientOriginalExtension();
          $fileNameToStore = $filename . '_' . time() . '.' . $extension;
          // Upload Image
          $path = $request-&gt;file('imagemain')-&gt;move('public/blogsimages', $fileNameToStore);
          // Filename to store
          echo $fileNameToStore = $path;
      } else {
          $fileNameToStore = $request-&gt;input('imageold');
          // exit();
      }
  
      // Save the data to the database
      $post = Post::find($id);
  
      $post-&gt;title = $request-&gt;input('title');
      $post-&gt;slug = $request-&gt;input('slug');
      $post-&gt;category_id = $request-&gt;input('category_id');
      $post-&gt;description = $request-&gt;input('description');
      $post-&gt;short_description = $request-&gt;input('short_description');
      $post-&gt;date = $request-&gt;input('date');
      $post-&gt;image = $fileNameToStore;
      $post-&gt;meta_title = $request-&gt;input('meta_title');
      $post-&gt;meta_keywords = $request-&gt;input('meta_keywords');
      $post-&gt;authorname = $request-&gt;input('authorname');
  
      $post-&gt;save();
  
      if (isset($request-&gt;tags)) {
          $post-&gt;tags()-&gt;sync($request-&gt;tags);
      } else {
          $post-&gt;tags()-&gt;sync([]);
      }
  
      // set flash data with success message
      Session::flash('success', 'This post was successfully saved.');
  
      // redirect with flash data to posts.show
      return redirect()-&gt;route('posts.show', $post-&gt;id);
  }
  </code></pre>
  
  <p>when i post data everything updated as per requirement except image and form showing 302 here is screenshots:
  <a href="https://i.stack.imgur.com/x1q0T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x1q0T.png" alt="RESPONSE FROM SERVER"></a> 
  my routes is :  <code>Route::resource('posts', 'PostController');</code></p>