How is storage a public path? That path is above www, or htdocs, are you trying to use asset folder?,, I know for a fact this works,
public function add(Request $request)
{
if (isset($_POST['submit'])) {
echo "made it here";
$lid = DB::table('dc_dogs')->count();
$lid = $lid + 1;
$file = $request->file('ufile');
$file_name = $file->getClientOriginalName();
$file_ext = $file->getClientOriginalExtension();
$fileInfo = pathinfo($file_name);
$filename = $fileInfo['filename'];
$newname = $filename . $lid . "." . $file_ext;
$destinationPath = ASSET . 'upload/imgdogs';
$file->move($destinationPath, $newname);
$dogpic = Cln::fixValue($newname);
$dogname = ucfirst(Cln::fixValue($_POST['dogname']));
$sex = ucfirst($_POST['sex']);
$comments = Cln::fixValue($_POST['comments']);
$adopted = (isset($_POST['adopted']) == '1' ? '1' : '0'); ///added
$lastedit = date("Y-m-d H:i:s");
echo "adpt=" . $adopted . "aaa";
if (!isset($error)) {
$postdata = array(
'dogpic' => $dogpic,
'dogname' => $dogname,
'sex' => $sex,
'comments' => $comments,
'adopted' => $adopted,
'lastedit' => $lastedit
);
DB::table('dc_dogs')->insert($postdata);
}
}
$title = 'Dog add';
$view = 'dog/add';
$layout = ViewLayout::getLayout('admin/addtp');
$content = View::make($view);
return view($layout)->with('content', $content)->with('title', $title);
}
ASSET is a constant I made, to store you use a path, but to display via src it's a url. This works for assets folder. A lot of this stuff is just resolving a path correctly
To display
<td><img src="<?php echo asset('assets/upload/imgdogs') . '/' . $row->dogpic; ?>" alt=""></td>
All works, tested laravel 5.4
In fact here you go ASSET
define('ASSET', realpath(dirname(__FILE__)). DS . 'assets' . DS);
You have to define DS also, here you go
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
Ignore this part
$title = 'Dog add';
$view = 'dog/add';
$layout = ViewLayout::getLayout('admin/addtp');
$content = View::make($view);
return view($layout)->with('content', $content)->with('title', $title);
I use php / html, not blade. Just some tweaks for me , got info from the api docs.