use BookStack\Exceptions\FileUploadException;
use Exception;
-use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Contracts\Filesystem\Filesystem as Storage;
use Illuminate\Filesystem\FilesystemManager;
use Illuminate\Support\Facades\Log;
/**
* Stream an attachment from storage.
*
- * @throws FileNotFoundException
- *
* @return resource|null
*/
public function streamAttachmentFromStorage(Attachment $attachment)
return $this->getStorageDisk()->readStream($this->adjustPathForStorageDisk($attachment->path));
}
+ /**
+ * Read the file size of an attachment from storage, in bytes.
+ */
+ public function getAttachmentFileSize(Attachment $attachment): int
+ {
+ return $this->getStorageDisk()->size($this->adjustPathForStorageDisk($attachment->path));
+ }
+
/**
* Store a new attachment upon user upload.
*