If I have an asset resource, loaded successfully from the database, whose corresponding file no longer exists on its Volume (irrespective of Volume type), what is the best way to find out if the file exists, in PHP?

file_exists or maybe is_file?

Or is there an inbuilt method in Craft I should be using?

Any help appreciated!

1 Answer 1


Using PHP's file_exists function is perfectly fine for checking this.

$exists = file_exists($path);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.