Php 图像上载表单获取最大文件大小错误
你好,有人能告诉我为什么我的图片上传表单不工作吗?经过严格的测试后,我似乎无法将文件放到服务器上我上传的图像文件夹中。我不断得到一个最大文件大小的错误,即使我已经大大增加了允许的文件大小 再次感谢Php 图像上载表单获取最大文件大小错误,php,image,forms,webforms,Php,Image,Forms,Webforms,你好,有人能告诉我为什么我的图片上传表单不工作吗?经过严格的测试后,我似乎无法将文件放到服务器上我上传的图像文件夹中。我不断得到一个最大文件大小的错误,即使我已经大大增加了允许的文件大小 再次感谢 <?php // filename: upload.form.php // first let's set some variables // make a note of the current working directory relative to root. $directory
<?php
// filename: upload.form.php
// first let's set some variables
// make a note of the current working directory relative to root.
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
// make a note of the location of the upload handler
$uploadHandler = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'multiple.upload.processor.php';
// set a max file size for the html upload form
$max_file_size = 30000; // size in bytes
// now echo the html page
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Upload form</title>
</head>
<body id="body">
<form id="Upload" action="<?php echo $uploadHandler ?>" enctype="multipart/form-data" method="post">
<h1>
Sell-A-Car
</h1>
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>">
</p>
<p>
<label for="file1">Item Image 1:</label>
<input id="file1" type="file" name="file[]">
</p>
<p>
<label for="file2">Item image 2:</label>
<input id="file2" type="file" name="file[]">
</p>
<p>
<label for="file3">Item image 3:</label>
<input id="file3" type="file" name="file[]">
</p>
<p>
<label for="submit">Press to...</label>
<input id="submit" type="submit" name="submit" value="SELL IT!">
</p>
</form>
</body>
</html>
文件大小错误指的是您的PHP配置。如果您在共享主机上,无法修改您的主机,请尝试以下操作:
在PHP脚本的开头添加这些行
ini_set("post_max_size","64M");
ini_set("upload_max_filesize","64M");
如果不起作用,请在应用程序的主文件夹中创建一个.htaccess文件,然后添加
php_value upload_max_filesize 64M
php_value post_max_size 64M
您是如何使用提交的最大文件大小的?我想您可能需要增加php中的最大文件大小变量。iniHello我没有php.ini,老实说,我不确定它是什么:/heheNot相关,但是($文件[“文件”][“大小”]/100000
无法获取kB。您使用的是哪种服务器,可以使用.htaccess
文件?可能存在重复的
php_value upload_max_filesize 64M
php_value post_max_size 64M