|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
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