Ok, so I am trying to upload a file and I think my script is ok. I am getting an "can't write image data to path" exception.
dd(is_writable($path . $filename)); returns false, I just can't figure out why.
I am using Laravel 4.2 with Homestead and vagrant. I tried to sudo chmod -R 777 the path I am trying to upload the file to, and I also tried the same on mypc/Homestead.
I would really be thankful if somebody helped me out.
Try using some of these Laravel facades, will give you an easy way to check if the dir is writable or if it's a dir.
// Determine if the given path is a directory
File::isDirectory('directory');
// Determine if the given path is writable
File::isWritable('path');
There's also these sweet helpers
// Get the path to the Laravel root folder
app_path();
// Get the path to the public folder
public_path();
// App root path
base_path();
// Get the path to the storage folder
storage_path();
the problem over here was the ownership of the containing folder on the server. It was set to the 'root' user and was supposed to be owned by 'apache' to be written by our application.