librilladora/app/Http/Controllers/FileUploadController.php

25 lines
627 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class FileUploadController extends Controller {
public function fileUploadPost(Request $request)
{
$request->validate([
'archivo' => 'required|mimes:pdf|max:2048',
'bookletsize' => 'min:1'
]);
$fileName = time().'.'.$request->archivo->extension();
$request->archivo->move(public_path('uploads'), $fileName);
return redirect()->route("process", ['fileName' => $fileName, 'size' => $request->bookletsize]);
}
}