Hi I have this function below - if it reurns false I want to also return the error so I can print it in my calling function. Can I do this?
Cheers
Matt
function fileUpload($file) {
if ($file['type'] == "image/gif" || $file['type'] == "image/pjpeg"){ if (@copy ($file['tmp_name'], "images/" . $file['name']))
return true;
}else { return false;
}
}
$error = ""; function fileUpload($file) { global $error; if ($file['type'] == "image/gif" || $file['type'] == "image/pjpeg"){ if (@copy ($file['tmp_name'], "images/" . $file['name'])) return true; }else { $error = "Something went wrong"; return false; } }
if ( ! fileUpload ( $file ) ) { echo ( $error ); }
Course, there are numerous other ways of doing this. I persoanlly use two custom functions to handle/display errors.
-- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED]
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php