We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

File_exists path?

There is a wide variety of helpers that include the full path to specify location of resources. How would I go about using file_exists?

I have tried file_exists('https://example.com/public/images/...jpg') but it will always return false, how would I specify a path to help it validate to true?

file_exists is a php function and you will have a much easier time asking your question on stackoverflow or referring to the official php documents

https://php.net/manual/en/function.file-exists.php. https://php.net/manual/en/wrappers.php

It does seem like you are doing something way out of the ordinary however. Do you really need to check if a JPG exists on an external domain? Perhaps explaining what you are actually trying to do and where the file is located relative to the server running the code will help us assist you.



10.4k
edited Jul '14

I should've been a little more clear. It image is hosted on the same server but I don't know how to define the routing. With the image helper for example, it automatically goes from the project root. I want to use file_exists to check if a image in a folder exists. I can't specify the domain and just doing file_exists("public/images/..jpg") doesn't work either, so how would I use from the root directory?