php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14631 is_file : Same function, different behavior?
Submitted: 2001-12-20 14:38 UTC Modified: 2002-04-03 02:57 UTC
From: azibutotal at spray dot fr Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: azibutotal at spray dot fr
New email:
PHP Version: OS:

 

 [2001-12-20 14:38 UTC] azibutotal at spray dot fr
Hi gurus and Fellows.

I've been through the Bug Database but didn't find out a related bug.  

I use a function that is common to two different pages.
(see code Below). These two pages are located in the same directory on my
website.

For a given reason , (which I would like to know), the function is not
working any longer (but it USED to) on one of this page.
Actually I can point out where (what) it is not working :
->  if (is_file("upload/".$ZeFiles->file_name)){  ...
In one PHP page it says OK it is a file (and yes it is, if I type the address directly in the address bar) on the other page, it
says the opposite!!

If I take this condition off this condition it displays : 

Warning: Unable to open upload/1_o_alum_off.gif  
where "1_o_alum_off.gif" is the name of the (existing) picture...

The consequence being, I just cannot used the GetImageSize() function to retrieve the picture dimensions...

Any idea anyone ?


ThanX.



olivier aKa Cypher.


//___________________________________________

function listFilesFromDB($Ze_mydir, $connexion)
{//extract FileName from DB , gets its size and generate the
//Javascript code for a fitted "Pop Up" window.
 $appendIt="";
 $resultat = ExecRequete ("select * from Files where us_id=".$Ze_mydir,
$connexion);

   if (mysql_num_rows($resultat)) {

    while ($ZeFiles = LigneSuivante ($resultat))
    {
   if (!eregi(".mp3",$ZeFiles->file_name)){
      if (is_file("upload/".$ZeFiles->file_name)){   //just in case...//that's where the problem lies...
    $imagehw = GetImageSize("upload/".$ZeFiles->file_name); //let's create
PopUp to the Picture Dimensions...
    $imagewidth = $imagehw[0]+60;        //let's add an extra margin...
    $imageheight = $imagehw[1]+75;
    $zePopUpScript = "\n<a href=\"javascript:
window.open('showPortFolio.php?idFile=".$ZeFiles->file_id."','','resizable=y
es, scrollbars=yes, width=".$imagewidth .",height=".$imageheight."');
void('');\">";
    $appendIt.=
"<TR><TD>$ZeFiles->file_title</TD><TD>".$zePopUpScript."View</a></TD><TD><a
href=\"#\"
onClick=\"javascript:ConfDel(".$Ze_mydir.",".$ZeFiles->file_id.");\">Delete<
/a></TD></TR>\n";
    }
   }
   else {// it is a mp3  file : no need for PopUp...A link should do...
   $zePopUpScript = "link to Mp3 file ".$ZeFiles->file_name;
   $appendIt.=
"<TR><TD>$ZeFiles->file_title</TD><TD>".$zePopUpScript."View</a></TD><TD><a
href=\"?action=delete&file_id=".$ZeFiles->file_id."&id=".$Ze_mydir."\">Delet
e</a></TD></TR>\n";

   }
  }
  echo "<center>\n<table width=360><tr><td colspan=3><h1>-------------Your
Files-------------</h1></td></tr>\n$appendIt\n</table>\n</center>";

   }else{
  echo "<center>\n<h1>No Files so far</h1>\n</center>";
   }

}


// calling the function :
  listFilesFromDB($id,$connexion);

//___________________________________________


PS : Code for both page available upon Request.
PHPinfo : 
http://nfrance.com/~am17204/pont/brouillon/test.php

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-21 04:45 UTC] azibutotal at spray dot fr
A "PHP GURU" friend of mine finally found out a solution : 
I think I should share it with you : 
instead of 
if (is_file("upload/".$ZeFiles->file_name)){...  

You have to give the absolute (server-related) path to the file [PATH_TRANSLATED]: 

if (is_file("/home/circusp/am17204/upload/.. and so on..


Still, that doesn't account for the bug, as it works on the other file. That is just a "workaround" then. 

Hope this helps


 [2002-04-03 02:57 UTC] yohgaki@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php

You should know current directory... and how absolute/relative path works.
This is not a develper issue according to your last post.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 08:01:27 2025 UTC