Works on localhost. But when I upload on server it gives error
Here is my error code:
ErrorException in LecturerController.php line 1081:
file_put_contents(/var/www/k2b/data/www/laravel/dev.oasis-portal.my\files\tasks\dev site login.txt.txt): failed to open stream: Is a directory
My code:
$title = Input::get('title');
$description = Input::get('description');
$group_id = Input::get('group_id');
$date = Input::get('duedate');
$filename=Input::get('filename');
$lecturer_id = Input::get('lecturer_id');
$timestamps = new \DateTime();
$ext = Input::get('ext');
$file =$filename.'.'.$ext;
//$path = str_replace("/laravel","",base_path()).'/files/tasks/'.$file;
$path = str_replace("\laravel\dev.oasis-portal.my","\dev.oasis-portal.my",base_path()).'\files\tasks\'.$file;
$data = Request::get('file');
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
$data = base64_decode($data);
if (!is_dir(str_replace("\laravel\dev.oasis-portal.my","\dev.oasis-portal.my",base_path()).'\files\tasks\')) {
File::makeDirectory($path,0777,true);
}
//Write to File
$check = file_put_contents($path, $data);
$fileinformation = array('title' => $title, 'description'=> $description, 'duedate'=>$date,
'lecturer_id'=>$lecturer_id, 'file' => $file, 'group_id' => $group_id, 'created_at'=>$timestamps, 'updated_at'=>NULL);