Ниже вот мой уплоад файл, загружает картинку только.. что то я не могу сделать чтоб и файл загружал какойто(( в определенную папку, помогите пж
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title']='Добавить Картинку';
include_once '../../sys/inc/thead.php';
only_reg();
title();
aut();
$dirs=mysql_fetch_array(mysql_query("SELECT * FROM `torrent_dir` WHERE `id`='".intval($_GET['nid'])."';"));
if (isset($_GET['add']) && isset($_FILES['file'])){
if ($imgc=@imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])))
{
$name=my_esc($name);
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if ($img_x>2000 || $img_y>2000)$err='Размер изображения превышает ограничения в 2000*2000';
$opis=NULL;
if (isset($_POST['opis']))
$opis=stripslashes(htmlspecialchars(esc($_POST['opis'])));
if (!isset($err)){
// Изобретение года :-D
$s=$_SERVER['HTTP_HOST'];$fname=time().''.$p[1];
$sait="$s"."_"."$fname";
// Конец :-D
mysql_query("INSERT INTO `torrent_file` (`id_dir`, `name`, `ras`, `type`, `user_id`, `time`, `opis`) values ('$dirs[id]', '$sait', 'jpg', 'image/jpeg', '$user[id]', '$time', '$opis')");
$id_foto=mysql_insert_id();
if ($img_x==$img_y)
{
$dstW=48;
$dstH=48;
}elseif ($img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=48;
$dstH=ceil($dstW/$prop);
}else{
$prop=$img_y/$img_x;
$dstH=48;
$dstW=ceil($dstH/$prop);
}
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagejpeg($screen,H."modules/torrent/kartinki/48/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/48/$id_foto.jpg",0777);
imagedestroy($screen);
if ($img_x==$img_y)
{
$dstW=200; // ширина
$dstH=200; // высота
}
elseif ($img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=200;
$dstH=ceil($dstW/$prop);
}else{
$prop=$img_y/$img_x;
$dstH=200;
$dstW=ceil($dstH/$prop);
}
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
$screen=img_copyright($screen); // наложение копирайта
imagejpeg($screen,H."modules/torrent/kartinki/200/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/200/$id_foto.jpg",0777);
imagedestroy($screen);
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($screen);
$imgc=img_copyright($imgc); // наложение копирайта
imagejpeg($imgc,H."modules/torrent/kartinki/foto/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/foto/$id_foto.jpg",0777);
}else{
$imgc=img_copyright($imgc); // наложение копирайта
imagejpeg($imgc,H."modules/torrent/kartinki/foto/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/foto/$id_foto.jpg",0777);
}
imagedestroy($imgc);
//
header("Location: dir.php?nid=$dirs[id]");
//
}
else $err='Выбранный Вами формат изображения не поддерживается';
}
err();
###########################
echo "<form enctype='multipart/form-data' action='?nid=$dirs[id]&add' method='post'>";
echo "Файл:<br />\n";
echo "<input name='file' type='file' accept='image/*,image/jpeg' /><br />\n";
echo '<form action="/modules/torrent" method="post" enctype="multipart/form-data">
<input type="file" name="file_name">';
echo "Описание:<br />
<textarea name='opis'></textarea><br />";
echo "<input class='submit' type='submit' value='Выгрузить' />\n";
echo "/ <a href='dir.php?nid=$dirs[id]'>Отмена</a><br />\n";
echo "</form>";
include_once '../../sys/inc/tfoot.php';
?>
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title']='Добавить Картинку';
include_once '../../sys/inc/thead.php';
only_reg();
title();
aut();
$dirs=mysql_fetch_array(mysql_query("SELECT * FROM `torrent_dir` WHERE `id`='".intval($_GET['nid'])."';"));
if (isset($_GET['add']) && isset($_FILES['file'])){
if ($imgc=@imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'])))
{
$name=my_esc($name);
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if ($img_x>2000 || $img_y>2000)$err='Размер изображения превышает ограничения в 2000*2000';
$opis=NULL;
if (isset($_POST['opis']))
$opis=stripslashes(htmlspecialchars(esc($_POST['opis'])));
if (!isset($err)){
// Изобретение года :-D
$s=$_SERVER['HTTP_HOST'];$fname=time().''.$p[1];
$sait="$s"."_"."$fname";
// Конец :-D
mysql_query("INSERT INTO `torrent_file` (`id_dir`, `name`, `ras`, `type`, `user_id`, `time`, `opis`) values ('$dirs[id]', '$sait', 'jpg', 'image/jpeg', '$user[id]', '$time', '$opis')");
$id_foto=mysql_insert_id();
if ($img_x==$img_y)
{
$dstW=48;
$dstH=48;
}elseif ($img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=48;
$dstH=ceil($dstW/$prop);
}else{
$prop=$img_y/$img_x;
$dstH=48;
$dstW=ceil($dstH/$prop);
}
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagejpeg($screen,H."modules/torrent/kartinki/48/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/48/$id_foto.jpg",0777);
imagedestroy($screen);
if ($img_x==$img_y)
{
$dstW=200; // ширина
$dstH=200; // высота
}
elseif ($img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=200;
$dstH=ceil($dstW/$prop);
}else{
$prop=$img_y/$img_x;
$dstH=200;
$dstW=ceil($dstH/$prop);
}
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
$screen=img_copyright($screen); // наложение копирайта
imagejpeg($screen,H."modules/torrent/kartinki/200/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/200/$id_foto.jpg",0777);
imagedestroy($screen);
$screen=imagecreatetruecolor($dstW, $dstH);
imagecopyresampled($screen, $imgc, 0, 0, 0, 0, $dstW, $dstH, $img_x, $img_y);
imagedestroy($screen);
$imgc=img_copyright($imgc); // наложение копирайта
imagejpeg($imgc,H."modules/torrent/kartinki/foto/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/foto/$id_foto.jpg",0777);
}else{
$imgc=img_copyright($imgc); // наложение копирайта
imagejpeg($imgc,H."modules/torrent/kartinki/foto/$id_foto.jpg",90);
@chmod(H."modules/torrent/kartinki/foto/$id_foto.jpg",0777);
}
imagedestroy($imgc);
//
header("Location: dir.php?nid=$dirs[id]");
//
}
else $err='Выбранный Вами формат изображения не поддерживается';
}
err();
###########################
echo "<form enctype='multipart/form-data' action='?nid=$dirs[id]&add' method='post'>";
echo "Файл:<br />\n";
echo "<input name='file' type='file' accept='image/*,image/jpeg' /><br />\n";
echo '<form action="/modules/torrent" method="post" enctype="multipart/form-data">
<input type="file" name="file_name">';
echo "Описание:<br />
<textarea name='opis'></textarea><br />";
echo "<input class='submit' type='submit' value='Выгрузить' />\n";
echo "/ <a href='dir.php?nid=$dirs[id]'>Отмена</a><br />\n";
echo "</form>";
include_once '../../sys/inc/tfoot.php';
?>