0

I am trying to delete a file in Laravel but it is causing this exception:

unlink(D:\graduation project\kh\storage\app\upload/three.zip): Resource temporarily unavailable in D:\graduation project\kh\vendor\league\flysystem\src\Adapter\Local.php

before trying to delete the file i checked if it exists, checking returned a true value. here is my piece of code in the controller:

protected function saveFile(UploadedFile $file)
    {
        $zip = new Zipper;
        $fileName = $this->createFilename($file);

        $finalPath = storage_path().'/app/upload/';

        // move the file name
        $file->move($finalPath, $fileName);
        $zip->make($finalPath.$fileName)->extractTo($finalPath);
        $exist = Storage::disk('local')->exists('/upload/'.$fileName);
        if($exist){
           Storage::delete('/upload/'.$fileName) //I get the error here; 
        }

        return response()->json([
            'path' => $finalPath,
            'name' => $fileName,
            'exist' => $exist
        ]);
    }

and this is the response I get. It shows that the file exists (Note: when I took this image I commented the deletion line): response

sg7
  • 6,108
  • 2
  • 32
  • 40
Khaled Rimawi
  • 115
  • 1
  • 6

0 Answers0