Example #1
0
        $uploadOk = 0;
    }
    // Allow only certain file formats
    if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != 'pdf' && $imageFileType != 'txt') {
        $errorMessage = "Your file could not be uploaded (bad file type)";
        $uploadOk = 0;
    }
    // Check if $uploadOk is set to 0 by an error
    if ($uploadOk == 0) {
        $errorMessage = "Your file could not be uploaded";
        // if everything is ok, try to upload file
    } else {
        if (move_uploaded_file($_FILES["attachment"]["tmp_name"], $target_file)) {
            # Add attachment to issue via SOAP
            $attachmentContent = file_get_contents($target_file);
            $result = $client->mc_issue_attachment_add('Administrator', 'root', $newIssueId, $_FILES["attachment"]["name"], $imageFileType, $attachmentContent);
            unlink($target_file);
            #echo "The file ". basename( $_FILES["attachment"]["name"]). " has been uploaded.";
        } else {
            $errorMessage = "Your file could not be uploaded";
        }
    }
}
?>

<html>
<head>
  <title>Request to Use OKU Library Space</title>
  <link rel="stylesheet" type="text/css" href="css/roomreserve.css"/>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"/>