/** * Get all temporary images in session * * @return array */ public function all() { $dir = public_path() . '/uploads/temp/' . Session::getId() . '/'; $data = []; $mimetypes = new Mimetype(); if (file_exists($dir)) { foreach (scandir($dir) as $file) { if (in_array($file, ['.', '..'])) { continue; } $filedata = []; $filedata['name'] = $file; $filedata['url'] = url('/uploads/temp/' . Session::getId() . '/' . $file); $filedata['size'] = File::size($dir . $file); $filedata['type'] = $mimetypes->detectByFileExtension(File::extension($file)); $data[] = $filedata; } return $data; } }