1<?php
2namespace App\Http\Controllers;
3
4use Illuminate\Support\Facades\Request;
5
6
7class UploadController extends Controller
8{
9
10 public function upload(Request $request)
11 {
12
13 if(Request::hasFile('file')){
14
15 echo 'Uploaded';
16 $file = Request::file('file');
17 $file->move('uploads', $file->getClientOriginalName());
18 echo '$file' . $file->getClientOriginalName() . '"/>';
19 }
20
21 }
22}
23
1use Illuminate\Support\Facades\Request;
2
3
4class UploadController extends Controller
5{
6
7 public function upload(Request $request)
8 {
9
10 if(Request::hasFile('file')){
11
12 $file = Request::file('file');
13 $filename = $file->getClientOriginalName();
14 $path = public_path().'/uploads/';
15 return $file->move($path, $filename);
16 }
17
18 }
19}
20