Hey guys,
So I've got this code that forces a download when a user clicks a link. It basically looks at all the variables passed, knows which folder to look in, and sends the file to the browser. Easy.
Until I realized that for certain files, I have some that end in .zip and some that end in .sit (stuffit).
Right now it only checks for .zip files, and basically I need my function to output the proper response if either the .sit or the .zip file is there...
The premise behind the function is to check to see if a file is there, and if so, it displays a link to download the file - otherwise it says simply, "Not Available"...
Here's the function I'm working with:
function wheres_src ($type, $control, $cat) {
$sheet_base_dir = "/home/designcenter/public_html/datasheets/";
switch ($type) {
case "sourcel":
$ex = ".zip";
$ex2 = ".sit";
$fold = "/source/";
break;
case "sourcea4":
$ex = "_A4.zip";
$ex2 = "_A4.sit";
$fold = "/source/";
break;
}
$filezip = $sheet_base_dir.$cat.$fold.$control.$ex;
$filesit = $sheet_base_dir.$cat.$fold.$control.$ex2;
if (file_exists($filezip) || file_exists($filesit)) {
return true;
} else {
return false;
}
}
But, that doesn't work... it's still looking at only .zip stuff and it's only printing the link if it finds a zip.. but I need it to print a link if it's EITHER .sit OR .zip
Thanks in advance