<?php
// session_start();
// require_once 'includes/connect-db.php';
// $result = mysqli_query($connect, $query) or die("?????? " .
// mysqli_error($connect));
function can_upload($file){
// ???? ??? ??????, ?????? ???? ?? ??????
if($file['name'] == '')
return '?? ?? ??????? ????.';
/* ???? ?????? ????? 0, ?????? ??? ?? ?????????? ?????????
??????? ??-?? ????, ??? ?? ??????? ??????? */
if($file['size'] == 0)
return '???? ??????? ???????.';
// ????????? ??? ????? ?? ????? ? ???????? ??????
$getMime = explode('.', $file['name']);
// ??? ?????????? ????????? ??????? ??????? - ??????????
$mime = strtolower(end($getMime));
// ??????? ?????? ?????????? ??????????
$types = array('jpg', 'png', 'gif', 'bmp', 'jpeg');
// ???? ?????????? ?? ?????? ? ?????? ?????????? - return
if(!in_array($mime, $types))
return '???????????? ??? ?????.';
return true;
}
function make_upload($file){
// ????????? ?????????? ??? ????????: ????????? ????? ? name
$name = mt_rand(0, 10000) . $file['name'];
copy($file['tmp_name'], 'img/' . $name);
// $query_add ="INSERT INTO `pict`(`id`, `path`, `album-id`, `cathegory-id`, `title`) VALUES (NULL, $name,'[value-3]','[value-4]','[value-5]')";
}
|