$upload,
);
if(preg_match('/^([0-9]+)(\..*)/', $upload, $matches) == 0) {
$current['error'] = 'File is not in screens format';
$imports[] = $current;
$failed++;
continue;
}
$id = $matches[1];
$extension = $matches[2];
$size = getimagesize($upload_dir . $upload);
$width = $size[0];
$height = $size[1];
$file_size = filesize($upload_dir . $upload) / 1024;
$hash = md5_file($upload_dir . $upload);
$duplicate = check_duplicate($hash);
if($file_size > 2048) {
$current['error'] = 'File size exceeds 2048kb';
$imports[] = $current;
$failed++;
continue;
}
if(preg_match('/(gif|jpg|jpeg|png|bmp)/',$upload) == 0) {
$current['error'] = 'File extension not supported';
$imports[] = $current;
$failed++;
continue;
}
if($duplicate) {
$current['error'] = 'File is a duplicate: ' . $id;
$imports[] = $current;
$failed++;
continue;
}
$current['height'] = $height;
$current['width'] = $width;
$current['file_size'] = $file_size;
$current['hash'] = $hash;
$current['extension'] = $extension;
$imports[] = $current;
}
function check_duplicate($hash) {
// code incoming
return false;
}
?>
Total Imports: ( failed)
File Name | Dimensions | File Size | Hash | Extension | ||||
---|---|---|---|---|---|---|---|---|
x | kb |