View previous topic :: View next topic |
Author |
Message |
Gibbo
Joined: 26 Jul 2006 Posts: 17 Location: localhost
|
Posted: 27.07.2006 22:14 Post subject: da li datoteka postoji (PHP) |
|
|
imam gore naveden problem
kod mene lokalno sve radim, ali na serveru (SAFE MODE = ON) uvijek javlja da datoteka ne postoji. Ta mi provjera treba da znam dali da pravim male slicice ili ih vec imam generirane.
Naravno vodim racuna o velikim i malim slovima, i path je tocan(i na serveru i lokalno), ali i dalje dobivam da datoteka ne postoji osim ako su php datoteka i slika u istom folderu, e kako se radi o galeriji slika ta mogucnost ne dolazi u obzir.
Sta da radim?
primjer
Code: |
<?php
if(is_file("/var/www/web344/html/Images/bilder01/tb/tb_img_0010.jpg")){
echo "file exist<br>";
}else {
echo "file don't exist<br>";
}
if(is_file("/Images/bilder01/tb/tb_img_0010.jpg")){
echo "file exist<br>";
}else {
echo "file don't exist<br>";
}
if(file_exists("/var/www/web344/html/Images/bilder01/tb/tb_img_0010.jpg")){
echo "file exist<br>";
}else {
echo "file don't exist<br>";
}
if(file_exists("/Images/bilder01/tb/tb_img_0010.jpg")){
echo "file exist<br>";
}else {
echo "file don't exist<br>";
}
?>
|
OUTPUT
file don't exist
file don't exist
file don't exist
file don't exist |
|
|
Back to top |
|
|
Gale
Joined: 04 Apr 2005 Posts: 120
|
Posted: 27.07.2006 22:33 Post subject: |
|
|
probaj maknuti / prije Images i pazi na velika/mala slova |
|
|
Back to top |
|
|
gog
Joined: 18 Jun 2004 Posts: 679 Location: zagreb
|
Posted: 27.07.2006 22:52 Post subject: |
|
|
evo ti komentar sa php.net-a za file_exists funkciju:
Quote: | file_exists under safe_mode works (I work with for php 4) doesn't work when owner of the dir where the file stands differs from the php-owner.
e.g. file_exists in this dir will give FALSE nevertheless the file exists
rights owner dir
drwxr-xr-x apache images
change the owner of the dir to the phpowner and file_exists works.
I spent too much time to discover. Hope it will spare a lot of your time |
Isto je ja mislim za is_file...
p.s. Mislim da bi trebalo biti "file doesn't exist"... |
|
|
Back to top |
|
|
jokla
Joined: 31 Oct 2004 Posts: 113 Location: Right behind you
|
Posted: 28.07.2006 01:02 Post subject: |
|
|
jel ne bi trebali if-ovi biti elseif ( svi osim prvog ) |
_________________ "If this world makes you crazy, than everything is ok with you" - ~demony |
|
Back to top |
|
|
Gibbo
Joined: 26 Jul 2006 Posts: 17 Location: localhost
|
Posted: 28.07.2006 07:34 Post subject: |
|
|
ok probat cu |
|
|
Back to top |
|
|
gog
Joined: 18 Jun 2004 Posts: 679 Location: zagreb
|
Posted: 28.07.2006 09:52 Post subject: |
|
|
jokla wrote: | jel ne bi trebali if-ovi biti elseif ( svi osim prvog ) |
Ne bi |
|
|
Back to top |
|
|
|