2021-11-27 12:51:28 -03:00
|
|
|
<?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([
|
2021-11-28 20:13:58 -03:00
|
|
|
'archivo' => 'required|mimes:pdf|max:2048',
|
|
|
|
'bookletsize' => 'min:1'
|
2021-11-27 12:51:28 -03:00
|
|
|
]);
|
|
|
|
|
2021-11-28 20:13:58 -03:00
|
|
|
$fileName = time().'.'.$request->archivo->extension();
|
|
|
|
$request->archivo->move(public_path('uploads'), $fileName);
|
2021-11-27 12:51:28 -03:00
|
|
|
|
2021-11-28 20:13:58 -03:00
|
|
|
return redirect()->route("process", ['fileName' => $fileName, 'size' => $request->bookletsize]);
|
2021-11-27 12:51:28 -03:00
|
|
|
}
|
|
|
|
}
|