Exemplo n.º 1
0
    <div class="alert alert-danger alert-dismissible col-md-6" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <?php 
    echo $error_msg;
    ?>
    </div>
</div>
<?php 
    exit(0);
} elseif ($_FILES['file']['error'] == 4) {
    // no file
    1;
} else {
    // successfully upload file
    // check
    if (checkplain($_FILES['file']['tmp_name']) == 0) {
        // whether it is a text file
        $error_msg = 'ERROR: The uploaded file seems not like a text file. Please edit your file and upload again.';
    } elseif ($_FILES['file']['size'] > 100000) {
        // whether file is too large
        $error_msg = 'ERROR: The uploaded file is too large. Only files <strong><100KB</strong> are allowed.';
    }
    if (isset($error_msg)) {
        ?>
<div class="row">
    <div class="alert alert-danger alert-dismissible col-md-6" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <?php 
        echo $error_msg;
        ?>
    </div>
Exemplo n.º 2
0
     <div class="alert alert-danger alert-dismissible col-md-6" role="alert">
         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
         <?php 
     echo $error_msg;
     ?>
     </div>
 </div>
 <?php 
     exit(0);
 } elseif ($_FILES[$filemark]['error'] == 4) {
     // no file
     1;
 } else {
     // successfully upload file
     // check
     if (checkplain($_FILES[$filemark]['tmp_name']) == 0) {
         // whether it is a text file
         $error_msg = 'ERROR: The uploaded file seems not like a text file. Please edit your file and upload again.';
     } elseif ($_FILES[$filemark]['size'] > 100000) {
         // whether file is too large
         $error_msg = 'ERROR: The uploaded file is too large. Only files <strong><100KB</strong> are allowed.';
     }
     if (isset($error_msg)) {
         ?>
 <div class="row">
     <div class="alert alert-danger alert-dismissible col-md-6" role="alert">
         <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
         <?php 
         echo $error_msg;
         ?>
     </div>