Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 613 Bytes

upload.md

File metadata and controls

28 lines (19 loc) · 613 Bytes

Upload

Uploading files is easy with Larupload. you can upload just like you do with other fields in your model. Larupload will automatically upload the file and store the information in the database.

<?php

namespace App\Http\Controllers;

use App\Models\Upload;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class UploadController extends Controller
{
    public function store(Request $request): RedirectResponse
    {
        $upload = new Upload;
        $upload->main_file = $request->file('file');
        $upload->save();

        return redirect()->back();
    }
}