I can't load big files to server. The problem is in that file $_FILES["filename"]["tmp_name"]
is empty if file a little more bigger then 2mb. I tried to change variables in php.ini
upload_max_filesize = 700M
post_max_size = 16M
but not working to. Also tried to add this variables to my .httaccess file - but 500 error appears.
Error code while uploading=1.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
Here is my uppload.php page, please anwer what I doing wrong? Thanx!
<?php
if(strlen($_FILES["filename"]["name"]))
{
$folder = "uploads/";
echo $folder;
$error = "";
if($_FILES["filename"]["size"] > 1024*700*1024)
{
$error .= "<b><p class=ErrorMessage>Размер файла превышает 5Mb</p></b><br>";
header("Location: upload.php?error=".$error, true, 303 );
}
if(!file_exists($folder.="hh/"))
{
if(!mkdir($folder, 0700))
$error .= "<b><p class=ErrorMessage>Folder not created</p></b><br>";
}
//echo "<br>".$_FILES["filename"]["tmp_name"]."<br>";
echo $folder.$_FILES["filename"]["name"]."<br>";
echo $_FILES["filename"]["error"]."<br>";
if(move_uploaded_file($_FILES["filename"]["tmp_name"], $folder.$_FILES["filename"]["name"]))
{
echo("Файл успешно загружен <br>");
echo("Характеристики файла: <br>");
echo("Имя файла: ");
echo($_FILES["filename"]["name"]);
echo("<br>Размер файла: ");
echo($_FILES["filename"]["size"]);
echo("<br>Каталог для загрузки: ");
echo($folder.=$_FILES["filename"]["name"]);
echo("<br>Тип файла: ");
echo($_FILES["filename"]["type"]);
}
else
{
$error .= "<b><p class=ErrorMessage>Ошибка загрузки файла</p></b><br>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Документ без названия</title>
</head>
<body>
<?php
if(isset($_REQUEST["error"]))
{
echo $_REQUEST["error"];
}
?>
<h2><p><b> Форма для загрузки файлов </b></p></h2>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="filename" READONLY><br>
<input name="Upload" type="submit" value="Upload"><br>
</form>
</body>
</html>