I can’t seem to get the following code to work?
$playerfileLocation = "../wp-content/gallery/playerphotos/' . $playerid . '.jpg";
if(file_exits($playerfileLocation))
echo "The file File exists";
else
echo "The file File does not exist";
The “playerid” field is a number that gets passed through.
I just can’t seem to get it working. Urgh!
You have mismatch of quotes. Try this code.
Update:
Actually I would suggest using below code as whenever PHP see double-quotes, it tries to parse anything in between it, which is not required in this case. This is a small optimization in performance.
Also, to just check if file exists and if not display default image use the following code: