procedural/tasks/task.php
# Returns true if file type is pdf or zip, false otherwise.
Returns true if file type is pdf or zip, false otherwise.
Returns true if file type is pdf or zip false otherwise .
function checkAttachment($file) {
    $regex = "/^.+(\.pdf|\.zip)$/";
    $res = preg_match($regex, $file["name"]);
    if (! $res)
        return false;
    $destination = "attachments/" . $file["name"];
    move_uploaded_file($file["tmp_name"], $destination);
    return true;
}
function checkAttachment ( $ file ) { $ regex = " /^.+(\.pdf|\.zip)$/ " ; $ res = preg_match ( $ regex , $ file [ " name " ] ) ; if ( ! $ res ) return false ; $ destination = " attachments/ " . $ file [ " name " ] ; move_uploaded_file ( $ file [ " tmp_name " ] , $ destination ) ; return true ; }
Returns true if file type is pdf or zip, false otherwise.
Returns true if file type is pdf or zip false otherwise .