2

I have this form that includes a Form::file along with other form stuff. say for example a Form::select what I'm trying to do is to retain the file inside the Form::file when the user made a mistake say for example the user did not entered a value for the Form::select.as of now i have this code, I tried to add the Input::old to my Form::file here is the code

{{ Form::file('cascUpload' , Input::old('cascUpload'), 
  array('id' => 'cascUpload' , 'type' => 'file' , 
 'accept' => '.doc , .docx , .pdf , .ppt , .pptx , .xlsx , .xls , .csv , .txt' )) 
}}

but it is not working. any ideas on what is wrong with my code? or on how I can improve it? thanks so much in advance!

Muhammad Shahzad
  • 9,340
  • 21
  • 86
  • 130
BourneShady
  • 955
  • 2
  • 17
  • 36

1 Answers1

0

If your form is using blade template and you have some kind of validation in your controller then you can redirect user back with all values inserted/selected just by using withInput() in your controller.

return Redirect('page_url')->withInput();

See more in documentation

KuKeC
  • 4,392
  • 5
  • 31
  • 60