I have include this on top of my file
use Request;
and also,
use Illuminate\\Http\\Request;
When I tried use
$files = $request->file('images');
dd($files);
I kept getting
ErrorException in PortfolioController.php line 113: Undefined variable: request
Why ?
According to the doc of 5.1
https://laravel.com/docs/5.1/requests
use Illuminate\\Http\\Request;
should be enough.
public function update($id) {
$files = $request->file('images');
...
}
Just remove use Request;
In action of your controller you should use the request as parameter:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PortfolioController extends Controller {
public function update(Request $request, $id) {
$files = $request->file('images');
dd($files, $id);
// the rest of your code
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.