@file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nmotion
Forum Commoner
Posts: 32
Joined: Wed Jan 22, 2003 6:53 am

@file

Post by nmotion »

I use @file to check if an image excist.

Like this:

Code: Select all

if (@file("http://www.somesite.com/image.jpg"))
This works perfectly on one hosting partner and for some reason not on another. Anybody know what could be wrong?
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

I would suggest using file_exists() rather than @file.

ex: if(file_exists('your_file_here.ext'))

Useful function, and more efficient.

and in reponse to your original question, without some details as to the hosting partners, what version of php, what OS, etc., we cannot really figure things out.
nmotion
Forum Commoner
Posts: 32
Joined: Wed Jan 22, 2003 6:53 am

Post by nmotion »

This only seem to work on local files. Is there a way to check if a file on another web server exists.
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

@getimagesize should work on remote files

also, it only reads the header information so would be a lot faster than @file
nmotion
Forum Commoner
Posts: 32
Joined: Wed Jan 22, 2003 6:53 am

Post by nmotion »

This also works on one server and not the other. The one it does NOT work on is a :

Operating System Linux
Kernel Version 2.4.20-grsec
Last Reboot 12days, 5:44min
Apache Version 1.3.27 (Unix)
Perl Version 5.006001
PHP Version 4.3.1
MySQL Version 3.23.54
cPanel Version 6.0.0-STABLE
cPanel Build 109
Post Reply