Hello
Here is what I am trying to do. I have a directory on my server that holds modules for download. Users can upload modules to this dir.
Now I query my DB for all of the Module names and list them out. Now it is possible that a old module is still in the DB but the actual file is not in the modules directory. So if it is not in the directory, I jsut want to show the name, otherwise I want to show a link so they can download the latest module.
Here is some basic code:
[code]
//here I query for the URL of the site from the company table in order to put it in the download URL
$query = “select URL from company”;
$tempresult = @mysql_query($query);
$temprow = @mysql_fetch_array($tempresult);
for ($i = 0; $i < @mysql_num_rows($result); $i++)
{
$row = @mysql_fetch_array($result);
$file = $temprow[“URL”].”/modules/”.$row[“ModuleName”];
$value .= “<tr>
<td width=300>”;
//here I check to see if the file exists in the dir. If not then I do not show a link
//to download it
if (!is_file($file))
$value .= $row[“ModuleName”].” (File Missing).”;
else
$value .= “<a href=””.$file.””>”.$row[“ModuleName”].”</a>”;
$value .= “</td>
<td width=300>
“.$row[“Version”].”
</td>
<td>
“.$row[“LastChangeDate”].”
</td>
</tr>”;
}
As of right now if I use either is_file() or file_exists() and pass in $file, everything is normal text not a link. I know for a fact most of these are in the dir. I just know that I am doing something wrong. Can you not pass in the full URL to a file into one of these functions? If not, then how do I determine if the file does in fact exist at this location?
Thank you for any help with this.