12 January 2012

How to check if a file exists on remote/local server using php

Linking to a file or displaying an image from remote server is very common practice these days. But problem occurs when the file is not there on the remote server and our page starts showing a broken link. For this problem I have few solutions that will help you in avoiding this issue.

Solution # 1: Using file_exists()

Syntax
file_exists(string $filename)