Reputation: 55
I need to check if a file in the same folder as the script exists and is greater than 100 Bytes, if so echo "is there".
Upvotes: 2
Views: 7962
Reputation: 1741
I believe you're trying to do something like this:
$filename = 'test.txt';
if (file_exists($filename) && filesize($filename) > 100) {
echo "is there";
} else {
echo "not there";
}
Read the PHP documentation of filesize and file_exists for a more in-depth explanation.
Upvotes: 9
Reputation: 13725
Maybe something like this?
if(file_exists($filename) && filesize($filename) >100){
echo "is there";
}
Upvotes: 2