My blade.php
<?php echo Form::open(array('url' =>'/product/imgedit','files'=>'true'));
echo 'Adj meg egy új képet';
echo Form::file('image');
echo Form::submit('Upload File');
echo Form::close();?>
My routerRoute::get('product/{id}/imgedit', 'InventoryController@imgreq');
Route::post('product/imgedit', 'InventoryController@imgupl');
My Controller:public function imgreq($id){
$product = DB::select('select * FROM inventory WHERE barcode = ?', [$id]);;
return view('productimgupl',['product'=>$product]);
}
public function imgupl(){
$file = $request->file('image');
//Display File Name
echo 'File Name: '.$file->getClientOriginalName();
echo '<br>';
//Display File Extension
echo 'File Extension: '.$file->getClientOriginalExtension();
echo '<br>';
//Display File Real Path
echo 'File Real Path: '.$file->getRealPath();
echo '<br>';
//Display File Size
echo 'File Size: '.$file->getSize();
echo '<br>';
//Display File Mime Type
echo 'File Mime Type: '.$file->getMimeType();
//Move Uploaded File
$destinationPath = '/media/productimg/';
$file->move($destinationPath,$file->getClientOriginalName());
}
Error message:ErrorException in InventoryController.php line 28: Undefined variable: requestWhat I did wrong?
via Feralheart