flysystem-google-drive icon indicating copy to clipboard operation
flysystem-google-drive copied to clipboard

how to get file link after upalod?

Open hamedbaftam opened this issue 4 years ago • 1 comments

hi i want to get link of file when uploaded

hamedbaftam avatar Mar 17 '20 07:03 hamedbaftam

you can get fileid using following trick, It searches around 12000 files in 1.5 seconds.

function getId(Array $array, $key, $value)
{   
  foreach ($array as $subarray)
    {  
      if (isset($subarray[$key]) && $subarray[$key] == $value)
      return $subarray;       
    } 
}

$listContents = Storage::disk('google')->listContents();
$id = getId($listContents, 'name', $filename);
echo $id['path'];

ghost avatar Nov 27 '20 19:11 ghost