Reputation: 491
$path = (public_path("images/") . $filename);
echo $path;
C:\wamp\www\jobpost\public\images/Person.PNG //problem occur from this /
I want this path to access my picture
C:\wamp\www\jobpost\public\images\Person.PNG //how i can do this
(public_path("images\") . $filename);
//i add the slash like this error occur
Upvotes: 3
Views: 2469
Reputation: 8288
you are providing linux
directory separator , while you are in windows.
you may use the windows separator directly as follows:
$path = (public_path("images\\") . $filename);
or simply to make is safer you should use the DIRECTORY_SEPARATOR
pre-defined CONSTANT as follows:
$path = (public_path("images") . DIRECTORY_SEPARATOR . $filename);
the issue with that:
(public_path("images\") . $filename);
is that you are escaping the double quotes while you need it to enclose your string parameter.
Upvotes: 2