This has been reported on github. See if the solution works ok for you :-)
Feb 19, 2016
2
Level 4
request->all() doesn't work after file moving
class UploadController extends Controller
{
public function index(){
return view('upload');
}
public function store(UploadRequest $request){
$this->save_image($request);
}
private function save_image($request)
{
$file_extension = $request->file('image_file')->getClientOriginalExtension();
$new_filename = "product.$file_extension";
$upload_path = "files/products/";
dd($request->all()); // Works.
$request->file('image_file')->move($upload_path, $new_filename);
dd($request->all()); // Crashes.
}
}
I found something very odd while I was trying to solve this issue: https://laracasts.com/discuss/channels/laravel/the-file-privatevarfolders-does-not-exist
First dd($request->all()); display all the information in the request object like the following:
http://i.imgur.com/8NLhp8I.png
However, after moving a file the same code dd($request->all()); crashes complaining:
FileNotFoundException in File.php line 37: The file "/private/var/folders/_1/bsl_g_650hj2xx3hvyjjz_n40000gn/T/phpB0mSyd" does not exist
Am I damaging $request object while moving an uploaded file here??? What's happening?
Level 50
Please or to participate in this conversation.