laravel 5 ->getRealPath() doenst show correct value
Chances are your account's root is /data/sites/web/christophvhbe
, and that getRealPath
is entirely accurate (what you see in FTP is likely chrooted). As a result, your $imagePath
is actually the problem.
$imagePath = '/data/sites/web/christophvhbe/images/producten/'. $fileName;
Or, better yet, use Laravel's base_path
and/or public_path
helpers so if you ever change hosting it keeps working if the paths change:
$imagePath = public_path() . '/images/producten/' . $fileName;
If you consult your error logs, I'll bet you find permissions errors trying to create a file in the server's /images
directory, which on shared hosting you definitely won't be able to create or access.