<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class FileUploadController extends Controller
{
    public function showUploadForm()
    {
        return view('upload');
    }

    public function uploadFile(Request $request)
    {
        $request->validate([
            'file' => 'required|file|max:10240', // max 10MB
        ]);

        $file = $request->file('file');

        // Store file in storage/app/public/uploads
        $path = $file->store('uploads', 'public');

        return back()->with('success', 'File uploaded successfully! Path: ' . $path);
    }
}
