SangminKim's avatar

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?

0 likes
2 replies
ohffs's avatar
ohffs
Best Answer
Level 50

This has been reported on github. See if the solution works ok for you :-)

SangminKim's avatar

@ohffs THANKSS!!!! I downgraded it to 5.1 and everything works fine... Jesus Christ.... I can't believe I've tried everything to fix this issue for the last 24 hrs...- including reinstalling my mac!!

Please or to participate in this conversation.