Is this a laravel bug? Getting filepath after upload

Posted 5 months ago by woxene

I know how fileupload works and I know how to use it. But I found something strange today;

I get my path (and move the uploaded image) with this function: $path = $request->file('logo')->store('carrier_logo'); Which comes straight out of the laravel docs.

When I dump this variable using dd($path); the output is "carrier_logo/bHfFyYagJYG5nadKOVZjgxrRvncw4jsl7Of7PKEB.png"

Which is exactly what I want to write in my database. But when I merge this into the database something strange happens.. it changes into C:\xampp\tmp\php3C3A.tmpand I have no idea why or how this is happening..

Here is my full code:

    function store(Request $request)
            'name'              => 'required',
            'logo'              => 'nullable',
            'original_filename' => 'nullable',
        if ($request->hasFile('logo')) {
            $path = $request->file('logo')->store('carrier_logo');
            dd($path); //outputs: "carrier_logo/bHfFyYagJYG5nadKOVZjgxrRvncw4jsl7Of7PKEB.png"
                'logo'              => $path, //outputs : C:\xampp\tmp\php3C3A.tmp
                'original_filename' => $request->file('logo')->getClientOriginalName(),
        return redirect()->route('carriers.index')->with('toast', 'Carrier created successfully.');

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.