如何在php中编写ini_set

时间:2014-02-27 20:22:48

标签: php

如何通过php中的ini_set增加文件上传大小。默认文件大小为2mb。但我想增加尺寸。

$file=$_FILES['image']['tmp_name'];
$image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name= addslashes($_FILES['image']['name']);
$location="news/" . $_FILES["image"]["name"];


$q = mysql_query("INSERT INTO news(image) VALUES('$location')");

if(!$q)
{
echo mysql_error();
}
else
{

move_uploaded_file($_FILES["image"]["tmp_name"],"../news/" . $_FILES["image"]["name"]);
$_SESSION['mass_added']= 'echo"you are logged in"';
echo "<script>window.location = 'manage_news.php?user_type=admin'</script>";
}

1 个答案:

答案 0 :(得分:1)

您无法使用ini_set()执行此操作。检查:http://us1.php.net/manual/en/ini.list.php

<强> PHP_INI_PERDIR

Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)