Файл: public_html/admin/photo_upload.php
Строк: 25
<?php
include 'config.php';
echo dbconn();
if(isset($_FILES['image'])) {
$editid = $_POST["editid"];
$errors= array();
$file_name = $_FILES['image']['name'];
$file_size =$_FILES['image']['size'];
$file_tmp =$_FILES['image']['tmp_name'];
$file_type=$_FILES['image']['type'];
$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
$extensions = array("jpeg","jpg","png");
if(in_array($file_ext,$extensions )=== false){
header( 'Location: manage-articles.php?error=1' );
}
if($file_size > 2097152) {
header( 'Location: manage-articles.php?error=2' );
}
if(empty($errors)==true) {
move_uploaded_file($file_tmp,"uploads/".$file_name);
mysql_query("UPDATE rssarticles set item_image='<img src="admin/uploads/$file_name">' WHERE id ='$editid'");
mysql_query("UPDATE rssarticles set item_status='1' WHERE id ='$editid'");
header( 'Location: manage-articles.php?error=3' );
}
}
?>