Файл: hostbiter.ru/Modules/explode/uploadfile.php
Строк: 35
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/core.php');
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmhead.php');
if(!empty($_GET['dir'])){
$dir = htmlspecialchars(trim($_GET['dir']));
}else{
$dir = encode('www');
}
if(isset($_GET['upload'])){
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$fileinfo = pathinfo($_FILES['file']['tmp_name']);
if($filesize > 1048576*70) $err = 'Размер файла превышает 70 МБ!';
if(!$err){
$uploadfile = $_SERVER['DOCUMENT_ROOT'].'/tmp_files_isp/'.$_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'],$uploadfile);
$connect_ftp = ftp_connect($config['FTPHost'],21,300);
$ftp = $db->prepare("SELECT * FROM `ftp_users` WHERE `user` = ? LIMIT 1");
$ftp->execute([$user['id']]);
$ftp = $ftp->fetch();
ftp_login($connect_ftp,$ftp['login'],$ftp['password']);
ftp_chdir($connect_ftp,'/'.decode($dir));
ftp_put($connect_ftp,$_FILES['file']['name'],$uploadfile,FTP_ASCII);
ftp_close($connect_ftp);
unlink($uploadfile);
$_SESSION['message'] = 'Файл загружен!';
header("Location: /explode?dir=".$dir."");
exit;
}else{
$_SESSION['message'] = $err;
header("Location: /explode/uploadfile.php?dir=".$dir."");
exit;
}
}
?>
Максимальный размер файла: <b>70M.</b><br />
<form enctype="multipart/form-data" method="post" action="/explode/uploadfile.php?dir=<?=$dir?>&upload">
Файл: <br />
<input type="file" class="cxz" name="file" required/>
<input type="submit" class="gtab" name="upload" value="Загрузить" />
</form>
<div>
<img src="/image/bf.gif" alt="" /> <a href="/explode.php?dir=<?=$dir?>">Назад</a><br />
<img src="/image/bf.gif" alt="" /> <a href="/explode.php?">Файловый менеджер</a><br />
<?
require ($_SERVER['DOCUMENT_ROOT'].'/Core/fmfoot.php');
?>