Пример #1
0
function acceptImage($image)
{
    if (getimagesize($image["tmp_name"])) {
        $extension = pathinfo(basename($image["name"]), PATHINFO_EXTENSION);
        return checkSize($image['size']) and checkFileExtension($extension);
    }
    return false;
}
Пример #2
0
function testVille($ville)
{
    global $MINMAX, $errmsg;
    if (!checkSize($ville, "ville")) {
        return false;
    }
    if (preg_match("#^[A-Za-z\\-éèêàâôöçäœù' ]*\$#", $ville)) {
        return true;
    }
    $errmsg = $errmsg . "Le nom de ville ne peut pas contenir de caract&egrave;res sp&eacute;ciaux</br>\n";
    return false;
}
Пример #3
0
function printSpaceSize($size)
{
    return checkSize($size);
}
Пример #4
0
         echo json_encode(array('name' => $file_name, 'size' => $_FILES['ax_file_input']['size'], 'status' => -1, 'info' => $upload_errors[$_FILES['ax_file_input']['error']]));
         return false;
     }
 }
 /*
 * get the file size. In html5 upload by chunks we get the full file size from javascript
 * In a standard upload full size is returned by Global $_FILES
 */
 $full_size = $full_size ? $full_size : $_FILES['ax_file_input']['size'];
 //This checks are just one time
 if ($currByte == 0) {
     /*
      * If files size is greater than allowed then stop upload and return error
      * $max_file_size format: 12K, 13M, 6G ...
      */
     if (!checkSize($full_size, $max_file_size)) {
         echo json_encode(array('name' => $file_name, 'size' => $full_size, 'status' => -1, 'info' => 'File size exceeded maximum allowed: ' . $max_file_size));
         return false;
     }
     /*
      * Check if the file name has not allowed characters, removes them, and check if it is windows reserved
      */
     $tmp_fn = $file_name;
     $file_name = checkName($file_name);
     if (!$file_name) {
         echo json_encode(array('name' => $tmp_fn, 'size' => $full_size, 'status' => -1, 'info' => 'File name is not allowed. Windows reserved.'));
         return false;
     }
     /*
      * Check if file extension is in the allowed extensions
      * By defaul php, exe, html, js... are deny
Пример #5
0
function imageUpload($source, $destination, $thumb_destination)
{
    if (checkSize($source)) {
        makeThumb($source, $thumb_destination);
    }
    if (move_uploaded_file($source, $destination)) {
        return true;
    } else {
        return false;
    }
}